| 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(COMPILER_MSVC) | 7 #if defined(COMPILER_MSVC) |
| 8 // MSDN says to #include <intrin.h>, but that breaks the VS2005 build. | 8 // MSDN says to #include <intrin.h>, but that breaks the VS2005 build. |
| 9 extern "C" { | 9 extern "C" { |
| 10 void* _ReturnAddress(); | 10 void* _ReturnAddress(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return kNone; | 100 return kNone; |
| 101 } | 101 } |
| 102 bool Tracked::MissingBirthplace() const { return false; } | 102 bool Tracked::MissingBirthplace() const { return false; } |
| 103 void Tracked::ResetBirthTime() {} | 103 void Tracked::ResetBirthTime() {} |
| 104 | 104 |
| 105 #else | 105 #else |
| 106 | 106 |
| 107 Tracked::Tracked() | 107 Tracked::Tracked() |
| 108 : tracked_births_(NULL), | 108 : tracked_births_(NULL), |
| 109 tracked_birth_time_(TimeTicks::Now()) { | 109 tracked_birth_time_(TimeTicks::Now()) { |
| 110 if (!ThreadData::IsActive()) | |
| 111 return; | |
| 112 SetBirthPlace(Location("NoFunctionName", "NeedToSetBirthPlace", -1, NULL)); | |
| 113 } | 110 } |
| 114 | 111 |
| 115 Tracked::~Tracked() { | 112 Tracked::~Tracked() { |
| 116 if (!ThreadData::IsActive() || !tracked_births_) | 113 if (!ThreadData::IsActive() || !tracked_births_) |
| 117 return; | 114 return; |
| 118 ThreadData::current()->TallyADeath(*tracked_births_, | 115 ThreadData::current()->TallyADeath(*tracked_births_, |
| 119 TimeTicks::Now() - tracked_birth_time_); | 116 TimeTicks::Now() - tracked_birth_time_); |
| 120 } | 117 } |
| 121 | 118 |
| 122 void Tracked::SetBirthPlace(const Location& from_here) { | 119 void Tracked::SetBirthPlace(const Location& from_here) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 140 tracked_birth_time_ = TimeTicks::Now(); | 137 tracked_birth_time_ = TimeTicks::Now(); |
| 141 } | 138 } |
| 142 | 139 |
| 143 bool Tracked::MissingBirthplace() const { | 140 bool Tracked::MissingBirthplace() const { |
| 144 return -1 == tracked_births_->location().line_number(); | 141 return -1 == tracked_births_->location().line_number(); |
| 145 } | 142 } |
| 146 | 143 |
| 147 #endif // NDEBUG | 144 #endif // NDEBUG |
| 148 | 145 |
| 149 } // namespace tracked_objects | 146 } // namespace tracked_objects |
| OLD | NEW |