Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: base/thread.cc

Issue 18690: unbreak build (ui_tests) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/thread_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/thread.h" 5 #include "base/thread.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/thread_local.h" 9 #include "base/thread_local.h"
10 #include "base/waitable_event.h" 10 #include "base/waitable_event.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void Thread::ThreadMain() { 136 void Thread::ThreadMain() {
137 // The message loop for this thread. 137 // The message loop for this thread.
138 MessageLoop message_loop(startup_data_->options.message_loop_type); 138 MessageLoop message_loop(startup_data_->options.message_loop_type);
139 139
140 // Complete the initialization of our Thread object. 140 // Complete the initialization of our Thread object.
141 thread_id_ = PlatformThread::CurrentId(); 141 thread_id_ = PlatformThread::CurrentId();
142 PlatformThread::SetName(name_.c_str()); 142 PlatformThread::SetName(name_.c_str());
143 message_loop.set_thread_name(name_); 143 message_loop.set_thread_name(name_);
144 message_loop_ = &message_loop; 144 message_loop_ = &message_loop;
145 145
146 // Let the thread do extra initialization.
147 // Let's do this before signaling we are started.
148 Init();
149
150 startup_data_->event.Signal(); 146 startup_data_->event.Signal();
151 // startup_data_ can't be touched anymore since the starting thread is now 147 // startup_data_ can't be touched anymore since the starting thread is now
152 // unlocked. 148 // unlocked.
153 149
150 // Let the thread do extra initialization.
151 Init();
152
154 message_loop.Run(); 153 message_loop.Run();
155 154
156 // Let the thread do extra cleanup. 155 // Let the thread do extra cleanup.
157 CleanUp(); 156 CleanUp();
158 157
159 // Assert that MessageLoop::Quit was called by ThreadQuitTask. 158 // Assert that MessageLoop::Quit was called by ThreadQuitTask.
160 DCHECK(GetThreadWasQuitProperly()); 159 DCHECK(GetThreadWasQuitProperly());
161 160
162 // We can't receive messages anymore. 161 // We can't receive messages anymore.
163 message_loop_ = NULL; 162 message_loop_ = NULL;
164 } 163 }
165 164
166 } // namespace base 165 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698