Chromium Code Reviews| Index: base/tracked_objects.cc |
| diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc |
| index d24cedf159241d58a92909650de374f187dd85ae..21c1983c80aa89b7cb2c700aafe05841e43e7a13 100644 |
| --- a/base/tracked_objects.cc |
| +++ b/base/tracked_objects.cc |
| @@ -354,8 +354,11 @@ ThreadData* ThreadData::first() { |
| ThreadData* ThreadData::next() const { return next_; } |
| // static |
| -void ThreadData::InitializeThreadContext(const std::string& suggested_name) { |
| - Initialize(); |
| +void ThreadData::InitializeThreadContext(const std::string& suggested_name, |
| + bool is_worker_thread) { |
| + if (is_worker_thread) |
|
Lei Zhang
2016/05/12 19:47:40
Instead of adding another parameter, can the calle
Zhenyu Shan
2016/05/16 02:05:35
Done.
|
| + return; |
| + EnsureTlsInitialization(); |
| ThreadData* current_thread_data = |
| reinterpret_cast<ThreadData*>(tls_index_.Get()); |
| if (current_thread_data) |
| @@ -669,7 +672,7 @@ void ThreadData::OnProfilingPhaseCompletedOnThread(int profiling_phase) { |
| } |
| } |
| -void ThreadData::Initialize() { |
| +void ThreadData::EnsureTlsInitialization() { |
| if (base::subtle::Acquire_Load(&status_) >= DEACTIVATED) |
| return; // Someone else did the initialization. |
| // Due to racy lazy initialization in tests, we'll need to recheck status_ |
| @@ -709,7 +712,7 @@ void ThreadData::InitializeAndSetTrackingStatus(Status status) { |
| DCHECK_GE(status, DEACTIVATED); |
| DCHECK_LE(status, PROFILING_ACTIVE); |
| - Initialize(); // No-op if already initialized. |
| + EnsureTlsInitialization(); // No-op if already initialized. |
| if (status > DEACTIVATED) |
| status = PROFILING_ACTIVE; |