Chromium Code Reviews| Index: base/tracked_objects.cc |
| diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc |
| index 9029f4febda79c9206494fc19219994e4d455a15..9c4936537c93342905e6e8d8de0315aaa55305a3 100644 |
| --- a/base/tracked_objects.cc |
| +++ b/base/tracked_objects.cc |
| @@ -388,8 +388,7 @@ ThreadData* ThreadData::next() const { return next_; } |
| // static |
| void ThreadData::InitializeThreadContext(const std::string& suggested_name) { |
| - if (!Initialize()) // Always initialize if needed. |
| - return; |
| + Initialize(); // Always initialize if needed. |
|
cpu_(ooo_6.6-7.5)
2015/05/05 20:49:35
remove 0 new information comment of 391 pls.
|
| ThreadData* current_thread_data = |
| reinterpret_cast<ThreadData*>(tls_index_.Get()); |
| if (current_thread_data) |
| @@ -718,9 +717,9 @@ static void OptionallyInitializeAlternateTimer() { |
| ThreadData::SetAlternateTimeSource(alternate_time_source); |
| } |
| -bool ThreadData::Initialize() { |
| +void ThreadData::Initialize() { |
| if (status_ >= DEACTIVATED) |
| - return true; // Someone else did the initialization. |
| + return; // Someone else did the initialization. |
| // Due to racy lazy initialization in tests, we'll need to recheck status_ |
| // after we acquire the lock. |
| @@ -729,7 +728,7 @@ bool ThreadData::Initialize() { |
| // initialization. |
| base::AutoLock lock(*list_lock_.Pointer()); |
| if (status_ >= DEACTIVATED) |
| - return true; // Someone raced in here and beat us. |
| + return; // Someone raced in here and beat us. |
| // Put an alternate timer in place if the environment calls for it, such as |
| // for tracking TCMalloc allocations. This insertion is idempotent, so we |
| @@ -743,8 +742,7 @@ bool ThreadData::Initialize() { |
| if (!tls_index_.initialized()) { // Testing may have initialized this. |
| DCHECK_EQ(status_, UNINITIALIZED); |
| tls_index_.Initialize(&ThreadData::OnThreadTermination); |
| - if (!tls_index_.initialized()) |
| - return false; |
| + DCHECK(tls_index_.initialized()); |
| } else { |
| // TLS was initialzed for us earlier. |
| DCHECK_EQ(status_, DORMANT_DURING_TESTS); |
| @@ -759,21 +757,18 @@ bool ThreadData::Initialize() { |
| // we get the lock earlier in this method. |
| status_ = kInitialStartupState; |
| DCHECK(status_ != UNINITIALIZED); |
| - return true; |
| } |
| // static |
| -bool ThreadData::InitializeAndSetTrackingStatus(Status status) { |
| +void ThreadData::InitializeAndSetTrackingStatus(Status status) { |
| DCHECK_GE(status, DEACTIVATED); |
| DCHECK_LE(status, PROFILING_ACTIVE); |
| - if (!Initialize()) // No-op if already initialized. |
| - return false; // Not compiled in. |
| + Initialize(); // No-op if already initialized. |
| if (status > DEACTIVATED) |
| status = PROFILING_ACTIVE; |
| status_ = status; |
| - return true; |
| } |
| // static |
| @@ -827,8 +822,8 @@ void ThreadData::ShutdownSingleThreadedCleanup(bool leak) { |
| // This is only called from test code, where we need to cleanup so that |
| // additional tests can be run. |
| // We must be single threaded... but be careful anyway. |
| - if (!InitializeAndSetTrackingStatus(DEACTIVATED)) |
| - return; |
| + InitializeAndSetTrackingStatus(DEACTIVATED); |
| + |
| ThreadData* thread_data_list; |
| { |
| base::AutoLock lock(*list_lock_.Pointer()); |