| 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 #ifndef BASE_TRACKED_OBJECTS_H_ | 5 #ifndef BASE_TRACKED_OBJECTS_H_ |
| 6 #define BASE_TRACKED_OBJECTS_H_ | 6 #define BASE_TRACKED_OBJECTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 static void WriteHTMLTotalAndSubtotals( | 489 static void WriteHTMLTotalAndSubtotals( |
| 490 const DataCollector::Collection& match_array, | 490 const DataCollector::Collection& match_array, |
| 491 const Comparator& comparator, std::string* output); | 491 const Comparator& comparator, std::string* output); |
| 492 | 492 |
| 493 // In this thread's data, record a new birth. | 493 // In this thread's data, record a new birth. |
| 494 Births* TallyABirth(const Location& location); | 494 Births* TallyABirth(const Location& location); |
| 495 | 495 |
| 496 // Find a place to record a death on this thread. | 496 // Find a place to record a death on this thread. |
| 497 void TallyADeath(const Births& lifetimes, const base::TimeDelta& duration); | 497 void TallyADeath(const Births& lifetimes, const base::TimeDelta& duration); |
| 498 | 498 |
| 499 // Helper methods to only tally if the current thread has tracking active. |
| 500 // |
| 501 // TallyABirthIfActive will returns NULL if the birth cannot be tallied. |
| 502 static Births* TallyABirthIfActive(const Location& location); |
| 503 static void TallyADeathIfActive(const Births* lifetimes, |
| 504 const base::TimeDelta& duration); |
| 505 |
| 499 // (Thread safe) Get start of list of instances. | 506 // (Thread safe) Get start of list of instances. |
| 500 static ThreadData* first(); | 507 static ThreadData* first(); |
| 501 // Iterate through the null terminated list of instances. | 508 // Iterate through the null terminated list of instances. |
| 502 ThreadData* next() const { return next_; } | 509 ThreadData* next() const { return next_; } |
| 503 | 510 |
| 504 MessageLoop* message_loop() const { return message_loop_; } | 511 MessageLoop* message_loop() const { return message_loop_; } |
| 505 const std::string ThreadName() const; | 512 const std::string ThreadName() const; |
| 506 | 513 |
| 507 // Using our lock, make a copy of the specified maps. These calls may arrive | 514 // Using our lock, make a copy of the specified maps. These calls may arrive |
| 508 // from non-local threads, and are used to quickly scan data from all threads | 515 // from non-local threads, and are used to quickly scan data from all threads |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 }; | 666 }; |
| 660 static State state_; | 667 static State state_; |
| 661 | 668 |
| 662 DISALLOW_COPY_AND_ASSIGN(AutoTracking); | 669 DISALLOW_COPY_AND_ASSIGN(AutoTracking); |
| 663 }; | 670 }; |
| 664 | 671 |
| 665 | 672 |
| 666 } // namespace tracked_objects | 673 } // namespace tracked_objects |
| 667 | 674 |
| 668 #endif // BASE_TRACKED_OBJECTS_H_ | 675 #endif // BASE_TRACKED_OBJECTS_H_ |
| OLD | NEW |