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

Side by Side Diff: base/threading/thread.cc

Issue 8429009: Enable tracking of objects by default (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | « base/message_loop.cc ('k') | base/threading/worker_pool_posix.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 8 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 { 145 {
146 // The message loop for this thread. 146 // The message loop for this thread.
147 MessageLoop message_loop(startup_data_->options.message_loop_type); 147 MessageLoop message_loop(startup_data_->options.message_loop_type);
148 148
149 // Complete the initialization of our Thread object. 149 // Complete the initialization of our Thread object.
150 thread_id_ = PlatformThread::CurrentId(); 150 thread_id_ = PlatformThread::CurrentId();
151 PlatformThread::SetName(name_.c_str()); 151 PlatformThread::SetName(name_.c_str());
152 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector. 152 ANNOTATE_THREAD_NAME(name_.c_str()); // Tell the name to race detector.
153 message_loop.set_thread_name(name_); 153 message_loop.set_thread_name(name_);
154 message_loop_ = &message_loop; 154 message_loop_ = &message_loop;
155 #if defined(TRACK_ALL_TASK_OBJECTS)
156 tracked_objects::ThreadData::InitializeThreadContext(name_); 155 tracked_objects::ThreadData::InitializeThreadContext(name_);
157 #endif // TRACK_ALL_TASK_OBJECTS
158 156
159 // Let the thread do extra initialization. 157 // Let the thread do extra initialization.
160 // Let's do this before signaling we are started. 158 // Let's do this before signaling we are started.
161 Init(); 159 Init();
162 160
163 startup_data_->event.Signal(); 161 startup_data_->event.Signal();
164 // startup_data_ can't be touched anymore since the starting thread is now 162 // startup_data_ can't be touched anymore since the starting thread is now
165 // unlocked. 163 // unlocked.
166 164
167 Run(message_loop_); 165 Run(message_loop_);
168 166
169 // Let the thread do extra cleanup. 167 // Let the thread do extra cleanup.
170 CleanUp(); 168 CleanUp();
171 169
172 // Assert that MessageLoop::Quit was called by ThreadQuitTask. 170 // Assert that MessageLoop::Quit was called by ThreadQuitTask.
173 DCHECK(GetThreadWasQuitProperly()); 171 DCHECK(GetThreadWasQuitProperly());
174 172
175 // We can't receive messages anymore. 173 // We can't receive messages anymore.
176 message_loop_ = NULL; 174 message_loop_ = NULL;
177 } 175 }
178 thread_id_ = kInvalidThreadId; 176 thread_id_ = kInvalidThreadId;
179 } 177 }
180 178
181 } // namespace base 179 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/threading/worker_pool_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698