OLD | NEW |
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/tracked_objects.h" | 5 #include "base/tracked_objects.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 worker_thread_data = new ThreadData(); | 196 worker_thread_data = new ThreadData(); |
197 | 197 |
198 tls_index_.Set(worker_thread_data); | 198 tls_index_.Set(worker_thread_data); |
199 return worker_thread_data; | 199 return worker_thread_data; |
200 } | 200 } |
201 | 201 |
202 // static | 202 // static |
203 void ThreadData::OnThreadTermination(void* thread_data) { | 203 void ThreadData::OnThreadTermination(void* thread_data) { |
204 if (!kTrackAllTaskObjects) | 204 if (!kTrackAllTaskObjects) |
205 return; // Not compiled in. | 205 return; // Not compiled in. |
206 DCHECK(tls_index_.initialized()); | |
207 if (!thread_data) | 206 if (!thread_data) |
208 return; | 207 return; |
209 reinterpret_cast<ThreadData*>(thread_data)->OnThreadTerminationCleanup(); | 208 reinterpret_cast<ThreadData*>(thread_data)->OnThreadTerminationCleanup(); |
210 } | 209 } |
211 | 210 |
212 void ThreadData::OnThreadTerminationCleanup() const { | 211 void ThreadData::OnThreadTerminationCleanup() const { |
213 if (!is_a_worker_thread_) | 212 if (!is_a_worker_thread_) |
214 return; | 213 return; |
215 base::AutoLock lock(*list_lock_); | 214 base::AutoLock lock(*list_lock_); |
216 unregistered_thread_data_pool_->push(this); | 215 unregistered_thread_data_pool_->push(this); |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 1135 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
1137 sample.birth().birth_thread()->thread_name().c_str(), | 1136 sample.birth().birth_thread()->thread_name().c_str(), |
1138 (combined_selectors_ & DEATH_THREAD) ? "*" : | 1137 (combined_selectors_ & DEATH_THREAD) ? "*" : |
1139 sample.DeathThreadName().c_str()); | 1138 sample.DeathThreadName().c_str()); |
1140 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 1139 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
1141 !(combined_selectors_ & BIRTH_FUNCTION), | 1140 !(combined_selectors_ & BIRTH_FUNCTION), |
1142 output); | 1141 output); |
1143 } | 1142 } |
1144 | 1143 |
1145 } // namespace tracked_objects | 1144 } // namespace tracked_objects |
OLD | NEW |