Use libevent, second try.  Changes this time:
- remove bogus include of base/completion_callback.h
- add DEPS rules to allow including third_party/libevent

Review URL: http://codereview.chromium.org/2964

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2371 0039d316-1c4b-4281-b951-d872f2087c98
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 @@
   } 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