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