Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: base/tracked.h

Issue 7375006: Startup race fixes to tracked objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consistent ifdefs Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 //------------------------------------------------------------------------------ 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Used to record the FROM_HERE location of a caller. 106 // Used to record the FROM_HERE location of a caller.
107 void SetBirthPlace(const Location& from_here); 107 void SetBirthPlace(const Location& from_here);
108 const Location GetBirthPlace() const; 108 const Location GetBirthPlace() const;
109 109
110 // When a task sits around a long time, such as in a timer, or object watcher, 110 // When a task sits around a long time, such as in a timer, or object watcher,
111 // this method should be called when the task becomes active, and its 111 // this method should be called when the task becomes active, and its
112 // significant lifetime begins (and its waiting to be woken up has passed). 112 // significant lifetime begins (and its waiting to be woken up has passed).
113 void ResetBirthTime(); 113 void ResetBirthTime();
114 114
115 bool MissingBirthplace() const; 115 bool MissingBirthPlace() const;
116 116
117 #if defined(TRACK_ALL_TASK_OBJECTS) 117 #if defined(TRACK_ALL_TASK_OBJECTS)
118 base::TimeTicks tracked_birth_time() const { return tracked_birth_time_; } 118 base::TimeTicks tracked_birth_time() const { return tracked_birth_time_; }
119 #else 119 #else
120 base::TimeTicks tracked_birth_time() const { return base::TimeTicks::Now(); } 120 base::TimeTicks tracked_birth_time() const { return base::TimeTicks::Now(); }
121 #endif // defined(TRACK_ALL_TASK_OBJECTS) 121 #endif // defined(TRACK_ALL_TASK_OBJECTS)
122 122
123 // Returns null if SetBirthPlace has not been called. 123 // Returns null if SetBirthPlace has not been called.
124 const void* get_birth_program_counter() const { 124 const void* get_birth_program_counter() const {
125 return birth_program_counter_; 125 return birth_program_counter_;
(...skipping 13 matching lines...) Expand all
139 #endif // defined(TRACK_ALL_TASK_OBJECTS) 139 #endif // defined(TRACK_ALL_TASK_OBJECTS)
140 140
141 const void* birth_program_counter_; 141 const void* birth_program_counter_;
142 142
143 DISALLOW_COPY_AND_ASSIGN(Tracked); 143 DISALLOW_COPY_AND_ASSIGN(Tracked);
144 }; 144 };
145 145
146 } // namespace tracked_objects 146 } // namespace tracked_objects
147 147
148 #endif // BASE_TRACKED_H_ 148 #endif // BASE_TRACKED_H_
OLDNEW
« no previous file with comments | « base/message_loop.cc ('k') | base/tracked.cc » ('j') | base/tracked.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698