| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/base/auto_thread.h" | 5 #include "remoting/base/auto_thread.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 base::Bind(&AutoThread::QuitThread, base::Unretained(this), | 204 base::Bind(&AutoThread::QuitThread, base::Unretained(this), |
| 205 run_loop.QuitWhenIdleClosure())); | 205 run_loop.QuitWhenIdleClosure())); |
| 206 | 206 |
| 207 startup_data_->event.Signal(); | 207 startup_data_->event.Signal(); |
| 208 // startup_data_ can't be touched anymore since the starting thread is now | 208 // startup_data_ can't be touched anymore since the starting thread is now |
| 209 // unlocked. | 209 // unlocked. |
| 210 | 210 |
| 211 #if defined(OS_POSIX) && !defined(OS_NACL) | 211 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 212 // Allow threads running a MessageLoopForIO to use FileDescriptorWatcher. | 212 // Allow threads running a MessageLoopForIO to use FileDescriptorWatcher. |
| 213 std::unique_ptr<base::FileDescriptorWatcher> file_descriptor_watcher; | 213 std::unique_ptr<base::FileDescriptorWatcher> file_descriptor_watcher; |
| 214 if (startup_data_->loop_type == base::MessageLoop::TYPE_IO) { | 214 if (message_loop.type() == base::MessageLoop::TYPE_IO) { |
| 215 DCHECK_EQ(&message_loop, base::MessageLoopForIO::current()); | 215 DCHECK_EQ(&message_loop, base::MessageLoopForIO::current()); |
| 216 file_descriptor_watcher.reset( | 216 file_descriptor_watcher.reset( |
| 217 new base::FileDescriptorWatcher(base::MessageLoopForIO::current())); | 217 new base::FileDescriptorWatcher(base::MessageLoopForIO::current())); |
| 218 } | 218 } |
| 219 #endif | 219 #endif |
| 220 | 220 |
| 221 #if defined(OS_WIN) | 221 #if defined(OS_WIN) |
| 222 // Initialize COM on the thread, if requested. | 222 // Initialize COM on the thread, if requested. |
| 223 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer( | 223 std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer( |
| 224 CreateComInitializer(com_init_type_)); | 224 CreateComInitializer(com_init_type_)); |
| 225 #endif | 225 #endif |
| 226 | 226 |
| 227 run_loop.Run(); | 227 run_loop.Run(); |
| 228 | 228 |
| 229 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread. | 229 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread. |
| 230 DCHECK(was_quit_properly_); | 230 DCHECK(was_quit_properly_); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace base | 233 } // namespace base |
| OLD | NEW |