| 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 "base/tracked_objects.h" | 5 #include "base/tracked_objects.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 worker_thread_number_(thread_number) { | 213 worker_thread_number_(thread_number) { |
| 214 CHECK_GT(thread_number, 0); | 214 CHECK_GT(thread_number, 0); |
| 215 base::StringAppendF(&thread_name_, "WorkerThread-%d", thread_number); | 215 base::StringAppendF(&thread_name_, "WorkerThread-%d", thread_number); |
| 216 PushToHeadOfList(); // Which sets real incarnation_count_for_pool_. | 216 PushToHeadOfList(); // Which sets real incarnation_count_for_pool_. |
| 217 } | 217 } |
| 218 | 218 |
| 219 ThreadData::~ThreadData() {} | 219 ThreadData::~ThreadData() {} |
| 220 | 220 |
| 221 void ThreadData::PushToHeadOfList() { | 221 void ThreadData::PushToHeadOfList() { |
| 222 // Toss in a hint of randomness (atop the uniniitalized value). | 222 // Toss in a hint of randomness (atop the uniniitalized value). |
| 223 (void)VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(random_number_, | 223 (void)VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(&random_number_, |
| 224 sizeof(random_number_)); | 224 sizeof(random_number_)); |
| 225 random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0)); | 225 random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0)); |
| 226 random_number_ ^= (Now() - TrackedTime()).InMilliseconds(); | 226 random_number_ ^= (Now() - TrackedTime()).InMilliseconds(); |
| 227 | 227 |
| 228 DCHECK(!next_); | 228 DCHECK(!next_); |
| 229 base::AutoLock lock(*list_lock_.Pointer()); | 229 base::AutoLock lock(*list_lock_.Pointer()); |
| 230 incarnation_count_for_pool_ = incarnation_counter_; | 230 incarnation_count_for_pool_ = incarnation_counter_; |
| 231 next_ = all_thread_data_list_head_; | 231 next_ = all_thread_data_list_head_; |
| 232 all_thread_data_list_head_ = this; | 232 all_thread_data_list_head_ = this; |
| 233 } | 233 } |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 base::ListValue* DataCollector::ToValue() const { | 743 base::ListValue* DataCollector::ToValue() const { |
| 744 base::ListValue* list = new base::ListValue; | 744 base::ListValue* list = new base::ListValue; |
| 745 for (size_t i = 0; i < collection_.size(); ++i) { | 745 for (size_t i = 0; i < collection_.size(); ++i) { |
| 746 list->Append(collection_[i].ToValue()); | 746 list->Append(collection_[i].ToValue()); |
| 747 } | 747 } |
| 748 return list; | 748 return list; |
| 749 } | 749 } |
| 750 | 750 |
| 751 } // namespace tracked_objects | 751 } // namespace tracked_objects |
| OLD | NEW |