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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if (it != death_map_.end()) { | 270 if (it != death_map_.end()) { |
271 it->second.RecordDeath(duration); | 271 it->second.RecordDeath(duration); |
272 return; | 272 return; |
273 } | 273 } |
274 | 274 |
275 base::AutoLock lock(lock_); // Lock since the map may get relocated now. | 275 base::AutoLock lock(lock_); // Lock since the map may get relocated now. |
276 death_map_[&lifetimes].RecordDeath(duration); | 276 death_map_[&lifetimes].RecordDeath(duration); |
277 } | 277 } |
278 | 278 |
279 // static | 279 // static |
| 280 Births* ThreadData::TallyABirthIfActive(const Location& location) { |
| 281 if (IsActive()) { |
| 282 ThreadData* current_thread_data = current(); |
| 283 if (current_thread_data) { |
| 284 return current_thread_data->TallyABirth(location); |
| 285 } |
| 286 } |
| 287 |
| 288 return NULL; |
| 289 } |
| 290 |
| 291 // static |
| 292 void ThreadData::TallyADeathIfActive(const Births* the_birth, |
| 293 const base::TimeDelta& duration) { |
| 294 if (IsActive() && the_birth) { |
| 295 tracked_objects::ThreadData::current()->TallyADeath(*the_birth, duration); |
| 296 } |
| 297 } |
| 298 |
| 299 // static |
280 ThreadData* ThreadData::first() { | 300 ThreadData* ThreadData::first() { |
281 base::AutoLock lock(list_lock_); | 301 base::AutoLock lock(list_lock_); |
282 return first_; | 302 return first_; |
283 } | 303 } |
284 | 304 |
285 const std::string ThreadData::ThreadName() const { | 305 const std::string ThreadData::ThreadName() const { |
286 if (message_loop_) | 306 if (message_loop_) |
287 return message_loop_->thread_name(); | 307 return message_loop_->thread_name(); |
288 return "ThreadWithoutMessageLoop"; | 308 return "ThreadWithoutMessageLoop"; |
289 } | 309 } |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 1035 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
1016 sample.birth().birth_thread()->ThreadName().c_str(), | 1036 sample.birth().birth_thread()->ThreadName().c_str(), |
1017 (combined_selectors_ & DEATH_THREAD) ? "*" : | 1037 (combined_selectors_ & DEATH_THREAD) ? "*" : |
1018 sample.DeathThreadName().c_str()); | 1038 sample.DeathThreadName().c_str()); |
1019 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 1039 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
1020 !(combined_selectors_ & BIRTH_FUNCTION), | 1040 !(combined_selectors_ & BIRTH_FUNCTION), |
1021 output); | 1041 output); |
1022 } | 1042 } |
1023 | 1043 |
1024 } // namespace tracked_objects | 1044 } // namespace tracked_objects |
OLD | NEW |