| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Tracked is the base class for all tracked objects. During construction, it | 6 // Tracked is the base class for all tracked objects. During construction, it |
| 7 // registers the fact that an instance was created, and at destruction time, it | 7 // registers the fact that an instance was created, and at destruction time, it |
| 8 // records that event. The instance may be tagged with a name, which is refered | 8 // records that event. The instance may be tagged with a name, which is refered |
| 9 // to as its Location. The Location is a file and line number, most | 9 // to as its Location. The Location is a file and line number, most |
| 10 // typically indicated where the object was constructed. In some cases, as the | 10 // typically indicated where the object was constructed. In some cases, as the |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void SetBirthPlace(const Location& from_here); | 101 void SetBirthPlace(const Location& from_here); |
| 102 | 102 |
| 103 // When a task sits around a long time, such as in a timer, or object watcher, | 103 // When a task sits around a long time, such as in a timer, or object watcher, |
| 104 // this method should be called when the task becomes active, and its | 104 // this method should be called when the task becomes active, and its |
| 105 // significant lifetime begins (and its waiting to be woken up has passed). | 105 // significant lifetime begins (and its waiting to be woken up has passed). |
| 106 void ResetBirthTime(); | 106 void ResetBirthTime(); |
| 107 | 107 |
| 108 bool MissingBirthplace() const; | 108 bool MissingBirthplace() const; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 #ifdef TRACK_ALL_TASK_OBJECTS |
| 112 |
| 111 // Pointer to instance were counts of objects with the same birth location | 113 // Pointer to instance were counts of objects with the same birth location |
| 112 // (on the same thread) are stored. | 114 // (on the same thread) are stored. |
| 113 Births* tracked_births_; | 115 Births* tracked_births_; |
| 114 // The time this object was constructed. If its life consisted of a long | 116 // The time this object was constructed. If its life consisted of a long |
| 115 // waiting period, and then it became active, then this value is generally | 117 // waiting period, and then it became active, then this value is generally |
| 116 // reset before the object begins it active life. | 118 // reset before the object begins it active life. |
| 117 Time tracked_birth_time_; | 119 Time tracked_birth_time_; |
| 118 | 120 |
| 121 #endif // TRACK_ALL_TASK_OBJECTS |
| 122 |
| 119 DISALLOW_COPY_AND_ASSIGN(Tracked); | 123 DISALLOW_COPY_AND_ASSIGN(Tracked); |
| 120 }; | 124 }; |
| 121 | 125 |
| 122 } // namespace tracked_objects | 126 } // namespace tracked_objects |
| 123 | 127 |
| 124 #endif // BASE_TRACKED_H_ | 128 #endif // BASE_TRACKED_H_ |
| 125 | 129 |
| OLD | NEW |