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/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (!startup_data_->options.message_pump_factory.is_null()) { | 201 if (!startup_data_->options.message_pump_factory.is_null()) { |
202 message_loop.reset( | 202 message_loop.reset( |
203 new MessageLoop(startup_data_->options.message_pump_factory.Run())); | 203 new MessageLoop(startup_data_->options.message_pump_factory.Run())); |
204 } else { | 204 } else { |
205 message_loop.reset( | 205 message_loop.reset( |
206 new MessageLoop(startup_data_->options.message_loop_type)); | 206 new MessageLoop(startup_data_->options.message_loop_type)); |
207 } | 207 } |
208 | 208 |
209 // Complete the initialization of our Thread object. | 209 // Complete the initialization of our Thread object. |
210 thread_id_ = PlatformThread::CurrentId(); | 210 thread_id_ = PlatformThread::CurrentId(); |
211 PlatformThread::SetName(name_); | 211 PlatformThread::SetName(name_.c_str()); |
212 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. | 212 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. |
213 message_loop->set_thread_name(name_); | 213 message_loop->set_thread_name(name_); |
214 message_loop->SetTimerSlack(startup_data_->options.timer_slack); | 214 message_loop->SetTimerSlack(startup_data_->options.timer_slack); |
215 message_loop_ = message_loop.get(); | 215 message_loop_ = message_loop.get(); |
216 | 216 |
217 #if defined(OS_WIN) | 217 #if defined(OS_WIN) |
218 scoped_ptr<win::ScopedCOMInitializer> com_initializer; | 218 scoped_ptr<win::ScopedCOMInitializer> com_initializer; |
219 if (com_status_ != NONE) { | 219 if (com_status_ != NONE) { |
220 com_initializer.reset((com_status_ == STA) ? | 220 com_initializer.reset((com_status_ == STA) ? |
221 new win::ScopedCOMInitializer() : | 221 new win::ScopedCOMInitializer() : |
(...skipping 22 matching lines...) Expand all Loading... |
244 | 244 |
245 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. | 245 // Assert that MessageLoop::Quit was called by ThreadQuitHelper. |
246 DCHECK(GetThreadWasQuitProperly()); | 246 DCHECK(GetThreadWasQuitProperly()); |
247 | 247 |
248 // We can't receive messages anymore. | 248 // We can't receive messages anymore. |
249 message_loop_ = NULL; | 249 message_loop_ = NULL; |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 } // namespace base | 253 } // namespace base |
OLD | NEW |