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

Unified Diff: webrtc/base/macsocketserver.h

Issue 2316563002: Revert of Remove all reference to carbon api (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/iosfilesystem.mm ('k') | webrtc/base/macsocketserver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/macsocketserver.h
diff --git a/webrtc/base/macsocketserver.h b/webrtc/base/macsocketserver.h
index ed6d60e05e7b3da9f22caf0ac6b59c6e625e9c14..f85628b0c8ed09c5ca89b9022d3b695380b03f00 100644
--- a/webrtc/base/macsocketserver.h
+++ b/webrtc/base/macsocketserver.h
@@ -11,7 +11,9 @@
#define WEBRTC_BASE_MACSOCKETSERVER_H__
#include <set>
-#include <CoreFoundation/CoreFoundation.h>
+#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) // Invalid on IOS
+#include <Carbon/Carbon.h>
+#endif
#include "webrtc/base/physicalsocketserver.h"
namespace rtc {
@@ -74,6 +76,61 @@
CFRunLoopRef run_loop_;
CFRunLoopSourceRef wake_up_;
};
+
+#ifndef CARBON_DEPRECATED
+
+///////////////////////////////////////////////////////////////////////////////
+// MacCarbonSocketServer
+///////////////////////////////////////////////////////////////////////////////
+
+// Interacts with the Carbon event queue. While idle it will block,
+// waiting for events. When the socket server has work to do, it will
+// post a 'wake up' event to the queue, causing the thread to exit the
+// event loop until the next call to Wait. Other events are dispatched
+// to their target. Supports Carbon and Cocoa UI interaction.
+class MacCarbonSocketServer : public MacBaseSocketServer {
+ public:
+ MacCarbonSocketServer();
+ virtual ~MacCarbonSocketServer();
+
+ // SocketServer Interface
+ virtual bool Wait(int cms, bool process_io);
+ virtual void WakeUp();
+
+ private:
+ EventQueueRef event_queue_;
+ EventRef wake_up_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// MacCarbonAppSocketServer
+///////////////////////////////////////////////////////////////////////////////
+
+// Runs the Carbon application event loop on the current thread while
+// idle. When the socket server has work to do, it will post an event
+// to the queue, causing the thread to exit the event loop until the
+// next call to Wait. Other events are automatically dispatched to
+// their target.
+class MacCarbonAppSocketServer : public MacBaseSocketServer {
+ public:
+ MacCarbonAppSocketServer();
+ virtual ~MacCarbonAppSocketServer();
+
+ // SocketServer Interface
+ virtual bool Wait(int cms, bool process_io);
+ virtual void WakeUp();
+
+ private:
+ static OSStatus WakeUpEventHandler(EventHandlerCallRef next, EventRef event,
+ void *data);
+ static void TimerHandler(EventLoopTimerRef timer, void *data);
+
+ EventQueueRef event_queue_;
+ EventHandlerRef event_handler_;
+ EventLoopTimerRef timer_;
+};
+
+#endif
} // namespace rtc
#endif // WEBRTC_BASE_MACSOCKETSERVER_H__
« no previous file with comments | « webrtc/base/iosfilesystem.mm ('k') | webrtc/base/macsocketserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698