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 "base/threading/thread.h" | 5 #include "base/threading/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/location.h" | 9 #include "base/location.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 id_event_.Signal(); | 222 id_event_.Signal(); |
223 | 223 |
224 // Complete the initialization of our Thread object. | 224 // Complete the initialization of our Thread object. |
225 PlatformThread::SetName(name_.c_str()); | 225 PlatformThread::SetName(name_.c_str()); |
226 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. | 226 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. |
227 | 227 |
228 // Lazily initialize the message_loop so that it can run on this thread. | 228 // Lazily initialize the message_loop so that it can run on this thread. |
229 DCHECK(message_loop_); | 229 DCHECK(message_loop_); |
230 std::unique_ptr<MessageLoop> message_loop(message_loop_); | 230 std::unique_ptr<MessageLoop> message_loop(message_loop_); |
231 message_loop_->BindToCurrentThread(); | 231 message_loop_->BindToCurrentThread(); |
232 message_loop_->set_thread_name(name_); | |
233 message_loop_->SetTimerSlack(message_loop_timer_slack_); | 232 message_loop_->SetTimerSlack(message_loop_timer_slack_); |
234 | 233 |
235 #if defined(OS_WIN) | 234 #if defined(OS_WIN) |
236 std::unique_ptr<win::ScopedCOMInitializer> com_initializer; | 235 std::unique_ptr<win::ScopedCOMInitializer> com_initializer; |
237 if (com_status_ != NONE) { | 236 if (com_status_ != NONE) { |
238 com_initializer.reset((com_status_ == STA) ? | 237 com_initializer.reset((com_status_ == STA) ? |
239 new win::ScopedCOMInitializer() : | 238 new win::ScopedCOMInitializer() : |
240 new win::ScopedCOMInitializer(win::ScopedCOMInitializer::kMTA)); | 239 new win::ScopedCOMInitializer(win::ScopedCOMInitializer::kMTA)); |
241 } | 240 } |
242 #endif | 241 #endif |
(...skipping 28 matching lines...) Expand all Loading... |
271 // allow this. | 270 // allow this. |
272 DCHECK(GetThreadWasQuitProperly()); | 271 DCHECK(GetThreadWasQuitProperly()); |
273 } | 272 } |
274 | 273 |
275 // We can't receive messages anymore. | 274 // We can't receive messages anymore. |
276 // (The message loop is destructed at the end of this block) | 275 // (The message loop is destructed at the end of this block) |
277 message_loop_ = nullptr; | 276 message_loop_ = nullptr; |
278 } | 277 } |
279 | 278 |
280 } // namespace base | 279 } // namespace base |
OLD | NEW |