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 #include "base/tracked.h" | 5 #include "base/tracked.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/tracked_objects.h" | 8 #include "base/tracked_objects.h" |
9 | 9 |
10 using base::TimeTicks; | 10 using base::TimeTicks; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 //------------------------------------------------------------------------------ | 61 //------------------------------------------------------------------------------ |
62 | 62 |
63 #ifndef TRACK_ALL_TASK_OBJECTS | 63 #ifndef TRACK_ALL_TASK_OBJECTS |
64 | 64 |
65 Tracked::Tracked() {} | 65 Tracked::Tracked() {} |
66 Tracked::~Tracked() {} | 66 Tracked::~Tracked() {} |
67 void Tracked::SetBirthPlace(const Location& from_here) {} | 67 void Tracked::SetBirthPlace(const Location& from_here) {} |
| 68 const Location Tracked::GetBirthPlace() const { |
| 69 static Location kNone("NoFunctionName", "NeedToSetBirthPlace", -1); |
| 70 return kNone; |
| 71 } |
68 bool Tracked::MissingBirthplace() const { return false; } | 72 bool Tracked::MissingBirthplace() const { return false; } |
69 void Tracked::ResetBirthTime() {} | 73 void Tracked::ResetBirthTime() {} |
70 | 74 |
71 #else | 75 #else |
72 | 76 |
73 Tracked::Tracked() | 77 Tracked::Tracked() |
74 : tracked_births_(NULL), | 78 : tracked_births_(NULL), |
75 tracked_birth_time_(TimeTicks::Now()) { | 79 tracked_birth_time_(TimeTicks::Now()) { |
76 if (!ThreadData::IsActive()) | 80 if (!ThreadData::IsActive()) |
77 return; | 81 return; |
(...skipping 11 matching lines...) Expand all Loading... |
89 if (!ThreadData::IsActive()) | 93 if (!ThreadData::IsActive()) |
90 return; | 94 return; |
91 if (tracked_births_) | 95 if (tracked_births_) |
92 tracked_births_->ForgetBirth(); | 96 tracked_births_->ForgetBirth(); |
93 ThreadData* current_thread_data = ThreadData::current(); | 97 ThreadData* current_thread_data = ThreadData::current(); |
94 if (!current_thread_data) | 98 if (!current_thread_data) |
95 return; // Shutdown started, and this thread wasn't registered. | 99 return; // Shutdown started, and this thread wasn't registered. |
96 tracked_births_ = current_thread_data->TallyABirth(from_here); | 100 tracked_births_ = current_thread_data->TallyABirth(from_here); |
97 } | 101 } |
98 | 102 |
| 103 const Location Tracked::GetBirthPlace() const { |
| 104 return tracked_births_->location(); |
| 105 } |
| 106 |
99 void Tracked::ResetBirthTime() { | 107 void Tracked::ResetBirthTime() { |
100 tracked_birth_time_ = TimeTicks::Now(); | 108 tracked_birth_time_ = TimeTicks::Now(); |
101 } | 109 } |
102 | 110 |
103 bool Tracked::MissingBirthplace() const { | 111 bool Tracked::MissingBirthplace() const { |
104 return -1 == tracked_births_->location().line_number(); | 112 return -1 == tracked_births_->location().line_number(); |
105 } | 113 } |
106 | 114 |
107 #endif // NDEBUG | 115 #endif // NDEBUG |
108 | 116 |
109 } // namespace tracked_objects | 117 } // namespace tracked_objects |
OLD | NEW |