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

Unified Diff: base/message_loop.cc

Issue 2964: Use libevent, second try. Changes this time:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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 | « base/message_loop.h ('k') | base/message_pump_libevent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop.cc
===================================================================
--- base/message_loop.cc (revision 2361)
+++ base/message_loop.cc (working copy)
@@ -13,6 +13,10 @@
#include "base/string_util.h"
#include "base/thread_local.h"
+#if defined(OS_POSIX)
+#include "base/message_pump_libevent.h"
+#endif
+
// A lazily created thread local storage for quick access to a thread's message
// loop, if one exists. This should be safe and free of static constructors.
static base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr(
@@ -78,6 +82,12 @@
} else {
pump_ = new base::MessagePumpWin();
}
+#elif defined(OS_POSIX)
+ if (type_ == TYPE_IO) {
+ pump_ = new base::MessagePumpLibevent();
+ } else {
+ pump_ = new base::MessagePumpDefault();
+ }
#else
pump_ = new base::MessagePumpDefault();
#endif
@@ -561,4 +571,14 @@
pump_win()->WatchObject(object, watcher);
}
-#endif // defined(OS_WIN)
+#elif defined(OS_POSIX)
+
+void MessageLoopForIO::WatchSocket(int socket, short interest_mask,
+ struct event* e, Watcher* watcher) {
+ pump_libevent()->WatchSocket(socket, interest_mask, e, watcher);
+}
+
+void MessageLoopForIO::UnwatchSocket(struct event* e) {
+ pump_libevent()->UnwatchSocket(e);
+}
+#endif
« no previous file with comments | « base/message_loop.h ('k') | base/message_pump_libevent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698