OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 10 #include <set> |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 // seen a death count. This map changes as we do Append() calls, and is later | 696 // seen a death count. This map changes as we do Append() calls, and is later |
697 // used by AddListOfLivingObjects() to gather up unaccounted for births. | 697 // used by AddListOfLivingObjects() to gather up unaccounted for births. |
698 BirthCount global_birth_count_; | 698 BirthCount global_birth_count_; |
699 | 699 |
700 // The complete list of parent-child relationships among tasks. | 700 // The complete list of parent-child relationships among tasks. |
701 ThreadData::ParentChildSet parent_child_set_; | 701 ThreadData::ParentChildSet parent_child_set_; |
702 | 702 |
703 DISALLOW_COPY_AND_ASSIGN(DataCollector); | 703 DISALLOW_COPY_AND_ASSIGN(DataCollector); |
704 }; | 704 }; |
705 | 705 |
706 //------------------------------------------------------------------------------ | |
707 // Provide simple way to to start global tracking, and to tear down tracking | |
708 // when done. The design has evolved to *not* do any teardown (and just leak | |
709 // all allocated data structures). As a result, we don't have any code in this | |
710 // destructor, and perhaps this whole class should go away. | |
711 | |
712 class BASE_EXPORT AutoTracking { | |
713 public: | |
714 AutoTracking() { | |
715 ThreadData::Initialize(); | |
716 } | |
717 | |
718 ~AutoTracking() { | |
719 // TODO(jar): Consider emitting a CSV dump of the data at this point. This | |
720 // should be called after the message loops have all terminated (or at least | |
721 // the main message loop is gone), so there is little chance for additional | |
722 // tasks to be Run. | |
723 } | |
724 | |
725 private: | |
726 | |
727 DISALLOW_COPY_AND_ASSIGN(AutoTracking); | |
728 }; | |
729 | |
730 } // namespace tracked_objects | 706 } // namespace tracked_objects |
731 | 707 |
732 #endif // BASE_TRACKED_OBJECTS_H_ | 708 #endif // BASE_TRACKED_OBJECTS_H_ |
OLD | NEW |