Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: webrtc/base/macsocketserver.h

Issue 2369013002: Delete macsocketserver.h and related files. (Closed)
Patch Set: Drop macsocketserver_unittest.cc. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2007 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10 #ifndef WEBRTC_BASE_MACSOCKETSERVER_H__
11 #define WEBRTC_BASE_MACSOCKETSERVER_H__
12
13 #include <set>
14 #include <CoreFoundation/CoreFoundation.h>
15 #include "webrtc/base/physicalsocketserver.h"
16
17 namespace rtc {
18
19 ///////////////////////////////////////////////////////////////////////////////
20 // MacBaseSocketServer
21 ///////////////////////////////////////////////////////////////////////////////
22 class MacAsyncSocket;
23
24 class MacBaseSocketServer : public PhysicalSocketServer {
25 public:
26 MacBaseSocketServer();
27 ~MacBaseSocketServer() override;
28
29 // SocketServer Interface
30 Socket* CreateSocket(int type) override;
31 Socket* CreateSocket(int family, int type) override;
32
33 AsyncSocket* CreateAsyncSocket(int type) override;
34 AsyncSocket* CreateAsyncSocket(int family, int type) override;
35
36 bool Wait(int cms, bool process_io) override = 0;
37 void WakeUp() override = 0;
38
39 void RegisterSocket(MacAsyncSocket* socket);
40 void UnregisterSocket(MacAsyncSocket* socket);
41
42 // PhysicalSocketServer Overrides
43 bool SetPosixSignalHandler(int signum, void (*handler)(int)) override;
44
45 protected:
46 void EnableSocketCallbacks(bool enable);
47 const std::set<MacAsyncSocket*>& sockets() {
48 return sockets_;
49 }
50
51 private:
52 static void FileDescriptorCallback(CFFileDescriptorRef ref,
53 CFOptionFlags flags,
54 void* context);
55
56 std::set<MacAsyncSocket*> sockets_;
57 };
58
59 // Core Foundation implementation of the socket server. While idle it
60 // will run the current CF run loop. When the socket server has work
61 // to do the run loop will be paused. Does not support Carbon or Cocoa
62 // UI interaction.
63 class MacCFSocketServer : public MacBaseSocketServer {
64 public:
65 MacCFSocketServer();
66 ~MacCFSocketServer() override;
67
68 // SocketServer Interface
69 bool Wait(int cms, bool process_io) override;
70 void WakeUp() override;
71 void OnWakeUpCallback();
72
73 private:
74 CFRunLoopRef run_loop_;
75 CFRunLoopSourceRef wake_up_;
76 };
77 } // namespace rtc
78
79 #endif // WEBRTC_BASE_MACSOCKETSERVER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698