Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_objects.h" | 5 #include "base/tracked_objects.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 | 347 |
| 348 // static | 348 // static |
| 349 ThreadData* ThreadData::first() { | 349 ThreadData* ThreadData::first() { |
| 350 base::AutoLock lock(*list_lock_.Pointer()); | 350 base::AutoLock lock(*list_lock_.Pointer()); |
| 351 return all_thread_data_list_head_; | 351 return all_thread_data_list_head_; |
| 352 } | 352 } |
| 353 | 353 |
| 354 ThreadData* ThreadData::next() const { return next_; } | 354 ThreadData* ThreadData::next() const { return next_; } |
| 355 | 355 |
| 356 // static | 356 // static |
| 357 void ThreadData::InitializeThreadContext(const std::string& suggested_name) { | 357 void ThreadData::InitializeThreadContext(const std::string& suggested_name, |
| 358 bool is_worker_thread) { | |
| 358 Initialize(); | 359 Initialize(); |
| 359 ThreadData* current_thread_data = | 360 ThreadData* current_thread_data = |
| 360 reinterpret_cast<ThreadData*>(tls_index_.Get()); | 361 reinterpret_cast<ThreadData*>(tls_index_.Get()); |
| 361 if (current_thread_data) | 362 if (current_thread_data or is_worker_thread) |
|
jar (doing other things)
2016/04/20 04:34:51
The test for is_worker_thread should be done betwe
Zhenyu Shan
2016/05/04 23:33:03
Done.
| |
| 362 return; // Browser tests instigate this. | 363 return; // Browser tests instigate this. |
| 363 current_thread_data = new ThreadData(suggested_name); | 364 current_thread_data = new ThreadData(suggested_name); |
| 364 tls_index_.Set(current_thread_data); | 365 tls_index_.Set(current_thread_data); |
| 365 } | 366 } |
| 366 | 367 |
| 367 // static | 368 // static |
| 368 ThreadData* ThreadData::Get() { | 369 ThreadData* ThreadData::Get() { |
| 369 if (!tls_index_.initialized()) | 370 if (!tls_index_.initialized()) |
| 370 return NULL; // For unittests only. | 371 return NULL; // For unittests only. |
| 371 ThreadData* registered = reinterpret_cast<ThreadData*>(tls_index_.Get()); | 372 ThreadData* registered = reinterpret_cast<ThreadData*>(tls_index_.Get()); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 #endif | 969 #endif |
| 969 } | 970 } |
| 970 | 971 |
| 971 ProcessDataSnapshot::ProcessDataSnapshot(const ProcessDataSnapshot& other) = | 972 ProcessDataSnapshot::ProcessDataSnapshot(const ProcessDataSnapshot& other) = |
| 972 default; | 973 default; |
| 973 | 974 |
| 974 ProcessDataSnapshot::~ProcessDataSnapshot() { | 975 ProcessDataSnapshot::~ProcessDataSnapshot() { |
| 975 } | 976 } |
| 976 | 977 |
| 977 } // namespace tracked_objects | 978 } // namespace tracked_objects |
| OLD | NEW |