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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 486 |
487 // For a given accumulated array of results, use the comparator to sort and | 487 // For a given accumulated array of results, use the comparator to sort and |
488 // subtotal, writing the results to the output. | 488 // subtotal, writing the results to the output. |
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 |
496 // Find a place to record a death on this thread. | 497 // Find a place to record a death on this thread. |
497 void TallyADeath(const Births& lifetimes, const base::TimeDelta& duration); | 498 void TallyADeath(const Births& lifetimes, const base::TimeDelta& duration); |
498 | 499 |
| 500 // Helper methods to only tally if the current thread has tracking active. |
| 501 // |
| 502 // TallyABirthIfActive will returns NULL if the birth cannot be tallied. |
| 503 static Births* TallyABirthIfActive(const Location& location); |
| 504 static void TallyADeathIfActive(const Births* lifetimes, |
| 505 const base::TimeDelta& duration); |
| 506 |
499 // (Thread safe) Get start of list of instances. | 507 // (Thread safe) Get start of list of instances. |
500 static ThreadData* first(); | 508 static ThreadData* first(); |
501 // Iterate through the null terminated list of instances. | 509 // Iterate through the null terminated list of instances. |
502 ThreadData* next() const { return next_; } | 510 ThreadData* next() const { return next_; } |
503 | 511 |
504 MessageLoop* message_loop() const { return message_loop_; } | 512 MessageLoop* message_loop() const { return message_loop_; } |
505 const std::string ThreadName() const; | 513 const std::string ThreadName() const; |
506 | 514 |
507 // Using our lock, make a copy of the specified maps. These calls may arrive | 515 // 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 | 516 // 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 }; | 667 }; |
660 static State state_; | 668 static State state_; |
661 | 669 |
662 DISALLOW_COPY_AND_ASSIGN(AutoTracking); | 670 DISALLOW_COPY_AND_ASSIGN(AutoTracking); |
663 }; | 671 }; |
664 | 672 |
665 | 673 |
666 } // namespace tracked_objects | 674 } // namespace tracked_objects |
667 | 675 |
668 #endif // BASE_TRACKED_OBJECTS_H_ | 676 #endif // BASE_TRACKED_OBJECTS_H_ |
OLD | NEW |