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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Fields describing the desired thread behaviour. | 43 // Fields describing the desired thread behaviour. |
44 base::MessageLoop::Type loop_type; | 44 base::MessageLoop::Type loop_type; |
45 | 45 |
46 // Used to receive the AutoThreadTaskRunner for the thread. | 46 // Used to receive the AutoThreadTaskRunner for the thread. |
47 scoped_refptr<AutoThreadTaskRunner> task_runner; | 47 scoped_refptr<AutoThreadTaskRunner> task_runner; |
48 | 48 |
49 // Used to synchronize thread startup. | 49 // Used to synchronize thread startup. |
50 base::WaitableEvent event; | 50 base::WaitableEvent event; |
51 | 51 |
52 explicit StartupData(base::MessageLoop::Type type) | 52 explicit StartupData(base::MessageLoop::Type type) |
53 : loop_type(type), event(false, false) {} | 53 : loop_type(type), |
| 54 event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 55 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
54 }; | 56 }; |
55 | 57 |
56 // static | 58 // static |
57 scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithType( | 59 scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithType( |
58 const char* name, | 60 const char* name, |
59 scoped_refptr<AutoThreadTaskRunner> joiner, | 61 scoped_refptr<AutoThreadTaskRunner> joiner, |
60 base::MessageLoop::Type type) { | 62 base::MessageLoop::Type type) { |
61 AutoThread* thread = new AutoThread(name, joiner.get()); | 63 AutoThread* thread = new AutoThread(name, joiner.get()); |
62 scoped_refptr<AutoThreadTaskRunner> task_runner = thread->StartWithType(type); | 64 scoped_refptr<AutoThreadTaskRunner> task_runner = thread->StartWithType(type); |
63 if (!task_runner.get()) | 65 if (!task_runner.get()) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 CreateComInitializer(com_init_type_)); | 208 CreateComInitializer(com_init_type_)); |
207 #endif | 209 #endif |
208 | 210 |
209 message_loop.Run(); | 211 message_loop.Run(); |
210 | 212 |
211 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread. | 213 // Assert that MessageLoop::QuitWhenIdle was called by AutoThread::QuitThread. |
212 DCHECK(was_quit_properly_); | 214 DCHECK(was_quit_properly_); |
213 } | 215 } |
214 | 216 |
215 } // namespace base | 217 } // namespace base |
OLD | NEW |