| 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/third_party/dynamic_annotations/dynamic_annotations.h" | 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 10 #include "base/threading/thread_id_name_manager.h" |
| 10 #include "base/threading/thread_local.h" | 11 #include "base/threading/thread_local.h" |
| 11 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 12 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 13 | 14 |
| 14 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 15 #include "base/win/scoped_com_initializer.h" | 16 #include "base/win/scoped_com_initializer.h" |
| 16 #endif | 17 #endif |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 | 20 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 running_(false), | 59 running_(false), |
| 59 startup_data_(NULL), | 60 startup_data_(NULL), |
| 60 thread_(0), | 61 thread_(0), |
| 61 message_loop_(NULL), | 62 message_loop_(NULL), |
| 62 thread_id_(kInvalidThreadId), | 63 thread_id_(kInvalidThreadId), |
| 63 name_(name) { | 64 name_(name) { |
| 64 } | 65 } |
| 65 | 66 |
| 66 Thread::~Thread() { | 67 Thread::~Thread() { |
| 67 Stop(); | 68 Stop(); |
| 69 ThreadIdNameManager::GetInstance()->RemoveName(thread_id_); |
| 68 } | 70 } |
| 69 | 71 |
| 70 bool Thread::Start() { | 72 bool Thread::Start() { |
| 71 Options options; | 73 Options options; |
| 72 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| 73 if (com_status_ == STA) | 75 if (com_status_ == STA) |
| 74 options.message_loop_type = MessageLoop::TYPE_UI; | 76 options.message_loop_type = MessageLoop::TYPE_UI; |
| 75 #endif | 77 #endif |
| 76 return StartWithOptions(options); | 78 return StartWithOptions(options); |
| 77 } | 79 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 206 |
| 205 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. | 207 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. |
| 206 DCHECK(GetThreadWasQuitProperly()); | 208 DCHECK(GetThreadWasQuitProperly()); |
| 207 | 209 |
| 208 // We can't receive messages anymore. | 210 // We can't receive messages anymore. |
| 209 message_loop_ = NULL; | 211 message_loop_ = NULL; |
| 210 } | 212 } |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace base | 215 } // namespace base |
| OLD | NEW |