Chromium Code Reviews| Index: base/threading/thread.cc |
| diff --git a/base/threading/thread.cc b/base/threading/thread.cc |
| index 761bc871885ede525866ca4a6c3e6226cb0e3005..88025e96aa93ad6c2d39beaedcdad604bdced698 100644 |
| --- a/base/threading/thread.cc |
| +++ b/base/threading/thread.cc |
| @@ -17,6 +17,10 @@ |
| #include "base/threading/thread_restrictions.h" |
| #include "build/build_config.h" |
| +#if defined(OS_POSIX) && !defined(OS_NACL_SFI) |
| +#include "base/files/file_descriptor_watcher_posix.h" |
| +#endif |
| + |
| #if defined(OS_WIN) |
| #include "base/win/scoped_com_initializer.h" |
| #endif |
| @@ -295,6 +299,15 @@ void Thread::ThreadMain() { |
| message_loop_->BindToCurrentThread(); |
| message_loop_->SetTimerSlack(message_loop_timer_slack_); |
| +#if defined(OS_POSIX) && !defined(OS_NACL_SFI) |
| + // Allow threads running a MessageLoopForIO to use FileDescriptorWatcher API. |
| + std::unique_ptr<FileDescriptorWatcher> file_descriptor_watcher; |
| + if (MessageLoopForIO::IsCurrent()) { |
| + file_descriptor_watcher.reset( |
| + new FileDescriptorWatcher(MessageLoopForIO::current())); |
|
dcheng
2016/09/26 17:34:40
Is there a time when this wouldn't return the same
fdoray
2016/09/26 17:44:07
No.
message_loop_->BindToCurrentThread() above se
|
| + } |
| +#endif |
| + |
| #if defined(OS_WIN) |
| std::unique_ptr<win::ScopedCOMInitializer> com_initializer; |
| if (com_status_ != NONE) { |