summaryrefslogtreecommitdiffstats
path: root/base/message_loop.cc
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-18 00:10:38 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-18 00:10:38 +0000
commitdab8619b4848bb10dfe78a3f0c59d6e661ec9610 (patch)
tree187818b2b685f5545832b45bbd20d01b53aca6d5 /base/message_loop.cc
parent0fe41aecdbfd97633bda1a892b2f3efb60f1d3ed (diff)
downloadchromium_src-dab8619b4848bb10dfe78a3f0c59d6e661ec9610.zip
chromium_src-dab8619b4848bb10dfe78a3f0c59d6e661ec9610.tar.gz
chromium_src-dab8619b4848bb10dfe78a3f0c59d6e661ec9610.tar.bz2
Make tcp_client_socket_unittest pass on Linux.
Requires another changeset that puts libevent in third_party; I'll upload that next. This is not the final word; it makes too many syscalls per read. But it's a start. Review URL: http://codereview.chromium.org/3202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2346 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r--base/message_loop.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 4b95532..48e05eb 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -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 @@ MessageLoop::MessageLoop(Type type)
} 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 @@ void MessageLoopForIO::WatchObject(HANDLE object, Watcher* watcher) {
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