Index: remoting/base/auto_thread.cc |
diff --git a/remoting/base/auto_thread.cc b/remoting/base/auto_thread.cc |
index b9b8f3006dfae5d075553bda444b80573d92caab..0e56ab5437006edf8b1d85df378e034380515ffc 100644 |
--- a/remoting/base/auto_thread.cc |
+++ b/remoting/base/auto_thread.cc |
@@ -4,6 +4,8 @@ |
#include "remoting/base/auto_thread.h" |
+#include <memory> |
+ |
#include "base/bind.h" |
#include "base/callback.h" |
#include "base/lazy_instance.h" |
@@ -16,6 +18,10 @@ |
#include "build/build_config.h" |
#include "remoting/base/auto_thread_task_runner.h" |
+#if defined(OS_POSIX) && !defined(OS_NACL) |
+#include "base/files/file_descriptor_watcher_posix.h" |
+#endif |
+ |
#if defined(OS_WIN) |
#include "base/win/scoped_com_initializer.h" |
#endif |
@@ -202,6 +208,16 @@ void AutoThread::ThreadMain() { |
// startup_data_ can't be touched anymore since the starting thread is now |
// unlocked. |
+#if defined(OS_POSIX) && !defined(OS_NACL) |
+ // Allow threads running a MessageLoopForIO to use FileDescriptorWatcher. |
+ std::unique_ptr<base::FileDescriptorWatcher> file_descriptor_watcher; |
+ if (startup_data_->loop_type == base::MessageLoop::TYPE_IO) { |
Wez
2016/10/04 00:58:06
You shouldn't access startup_data_ here, since you
|
+ DCHECK_EQ(&message_loop, base::MessageLoopForIO::current()); |
+ file_descriptor_watcher.reset( |
+ new base::FileDescriptorWatcher(base::MessageLoopForIO::current())); |
+ } |
+#endif |
+ |
#if defined(OS_WIN) |
// Initialize COM on the thread, if requested. |
std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer( |