| 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_id_name_manager.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 running_(false), | 59 running_(false), |
| 60 startup_data_(NULL), | 60 startup_data_(NULL), |
| 61 thread_(0), | 61 thread_(0), |
| 62 message_loop_(NULL), | 62 message_loop_(NULL), |
| 63 thread_id_(kInvalidThreadId), | 63 thread_id_(kInvalidThreadId), |
| 64 name_(name) { | 64 name_(name) { |
| 65 } | 65 } |
| 66 | 66 |
| 67 Thread::~Thread() { | 67 Thread::~Thread() { |
| 68 Stop(); | 68 Stop(); |
| 69 ThreadIdNameManager::GetInstance()->RemoveName(thread_id_); | |
| 70 } | 69 } |
| 71 | 70 |
| 72 bool Thread::Start() { | 71 bool Thread::Start() { |
| 73 Options options; | 72 Options options; |
| 74 #if defined(OS_WIN) | 73 #if defined(OS_WIN) |
| 75 if (com_status_ == STA) | 74 if (com_status_ == STA) |
| 76 options.message_loop_type = MessageLoop::TYPE_UI; | 75 options.message_loop_type = MessageLoop::TYPE_UI; |
| 77 #endif | 76 #endif |
| 78 return StartWithOptions(options); | 77 return StartWithOptions(options); |
| 79 } | 78 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 212 |
| 214 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. | 213 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. |
| 215 DCHECK(GetThreadWasQuitProperly()); | 214 DCHECK(GetThreadWasQuitProperly()); |
| 216 | 215 |
| 217 // We can't receive messages anymore. | 216 // We can't receive messages anymore. |
| 218 message_loop_ = NULL; | 217 message_loop_ = NULL; |
| 219 } | 218 } |
| 220 } | 219 } |
| 221 | 220 |
| 222 } // namespace base | 221 } // namespace base |
| OLD | NEW |