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 <math.h> | 7 #include <math.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
| 10 #include "base/compiler_specific.h" |
10 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/process_util.h" | 13 #include "base/process_util.h" |
13 #include "base/profiler/alternate_timer.h" | 14 #include "base/profiler/alternate_timer.h" |
14 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
15 #include "base/third_party/valgrind/memcheck.h" | 16 #include "base/third_party/valgrind/memcheck.h" |
16 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
17 #include "base/port.h" | 18 #include "base/port.h" |
18 | 19 |
19 using base::TimeDelta; | 20 using base::TimeDelta; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 base::StringAppendF(&thread_name_, "WorkerThread-%d", thread_number); | 252 base::StringAppendF(&thread_name_, "WorkerThread-%d", thread_number); |
252 PushToHeadOfList(); // Which sets real incarnation_count_for_pool_. | 253 PushToHeadOfList(); // Which sets real incarnation_count_for_pool_. |
253 } | 254 } |
254 | 255 |
255 ThreadData::~ThreadData() {} | 256 ThreadData::~ThreadData() {} |
256 | 257 |
257 void ThreadData::PushToHeadOfList() { | 258 void ThreadData::PushToHeadOfList() { |
258 // Toss in a hint of randomness (atop the uniniitalized value). | 259 // Toss in a hint of randomness (atop the uniniitalized value). |
259 (void)VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(&random_number_, | 260 (void)VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(&random_number_, |
260 sizeof(random_number_)); | 261 sizeof(random_number_)); |
| 262 MSAN_UNPOISON(&random_number_, sizeof(random_number_)); |
261 random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0)); | 263 random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0)); |
262 random_number_ ^= (Now() - TrackedTime()).InMilliseconds(); | 264 random_number_ ^= (Now() - TrackedTime()).InMilliseconds(); |
263 | 265 |
264 DCHECK(!next_); | 266 DCHECK(!next_); |
265 base::AutoLock lock(*list_lock_.Pointer()); | 267 base::AutoLock lock(*list_lock_.Pointer()); |
266 incarnation_count_for_pool_ = incarnation_counter_; | 268 incarnation_count_for_pool_ = incarnation_counter_; |
267 next_ = all_thread_data_list_head_; | 269 next_ = all_thread_data_list_head_; |
268 all_thread_data_list_head_ = this; | 270 all_thread_data_list_head_ = this; |
269 } | 271 } |
270 | 272 |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 : process_id(base::GetCurrentProcId()) { | 863 : process_id(base::GetCurrentProcId()) { |
862 #else | 864 #else |
863 : process_id(0) { | 865 : process_id(0) { |
864 #endif | 866 #endif |
865 } | 867 } |
866 | 868 |
867 ProcessDataSnapshot::~ProcessDataSnapshot() { | 869 ProcessDataSnapshot::~ProcessDataSnapshot() { |
868 } | 870 } |
869 | 871 |
870 } // namespace tracked_objects | 872 } // namespace tracked_objects |
OLD | NEW |