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/third_party/dynamic_annotations/dynamic_annotations.h" | 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 return CreateWithType(name, joiner, base::MessageLoop::TYPE_DEFAULT); | 70 return CreateWithType(name, joiner, base::MessageLoop::TYPE_DEFAULT); |
71 } | 71 } |
72 | 72 |
73 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
74 // static | 74 // static |
75 scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithLoopAndComInitTypes( | 75 scoped_refptr<AutoThreadTaskRunner> AutoThread::CreateWithLoopAndComInitTypes( |
76 const char* name, | 76 const char* name, |
77 scoped_refptr<AutoThreadTaskRunner> joiner, | 77 scoped_refptr<AutoThreadTaskRunner> joiner, |
78 base::MessageLoop::Type loop_type, | 78 base::MessageLoop::Type loop_type, |
79 ComInitType com_init_type) { | 79 ComInitType com_init_type) { |
80 AutoThread* thread = new AutoThread(name, joiner); | 80 AutoThread* thread = new AutoThread(name, joiner.get()); |
Wez
2014/11/12 23:57:03
This should stay as |joiner|.
dcheng
2014/11/12 23:59:07
The constructor takes a raw pointer though, so thi
Wez
2014/11/13 00:18:39
I'd prefer we just switch the ctor to take a refpt
dcheng
2014/11/13 00:25:24
Previously, I was converting a lot of these by han
| |
81 thread->SetComInitType(com_init_type); | 81 thread->SetComInitType(com_init_type); |
82 scoped_refptr<AutoThreadTaskRunner> task_runner = | 82 scoped_refptr<AutoThreadTaskRunner> task_runner = |
83 thread->StartWithType(loop_type); | 83 thread->StartWithType(loop_type); |
84 if (!task_runner) | 84 if (!task_runner.get()) |
85 delete thread; | 85 delete thread; |
86 return task_runner; | 86 return task_runner; |
87 } | 87 } |
88 #endif | 88 #endif |
89 | 89 |
90 AutoThread::AutoThread(const char* name) | 90 AutoThread::AutoThread(const char* name) |
91 : startup_data_(NULL), | 91 : startup_data_(NULL), |
92 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
93 com_init_type_(COM_INIT_NONE), | 93 com_init_type_(COM_INIT_NONE), |
94 #endif | 94 #endif |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 CreateComInitializer(com_init_type_)); | 205 CreateComInitializer(com_init_type_)); |
206 #endif | 206 #endif |
207 | 207 |
208 message_loop.Run(); | 208 message_loop.Run(); |
209 | 209 |
210 // Assert that MessageLoop::Quit was called by AutoThread::QuitThread. | 210 // Assert that MessageLoop::Quit was called by AutoThread::QuitThread. |
211 DCHECK(was_quit_properly_); | 211 DCHECK(was_quit_properly_); |
212 } | 212 } |
213 | 213 |
214 } // namespace base | 214 } // namespace base |
OLD | NEW |