Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Side by Side Diff: base/tracked_objects.cc

Issue 8796005: Revert 112937 - Suppress unitialized use of memory for random_number_ seed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/third_party/valgrind/memcheck.h"
13 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
14 #include "build/build_config.h" 13 #include "build/build_config.h"
15 #include "base/port.h" 14 #include "base/port.h"
16 15
17 using base::TimeDelta; 16 using base::TimeDelta;
18 17
19 namespace tracked_objects { 18 namespace tracked_objects {
20 19
21 namespace { 20 namespace {
22 // Flag to compile out almost all of the task tracking code. 21 // Flag to compile out almost all of the task tracking code.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 next_retired_worker_(NULL), 211 next_retired_worker_(NULL),
213 worker_thread_number_(thread_number) { 212 worker_thread_number_(thread_number) {
214 CHECK_GT(thread_number, 0); 213 CHECK_GT(thread_number, 0);
215 base::StringAppendF(&thread_name_, "WorkerThread-%d", thread_number); 214 base::StringAppendF(&thread_name_, "WorkerThread-%d", thread_number);
216 PushToHeadOfList(); // Which sets real incarnation_count_for_pool_. 215 PushToHeadOfList(); // Which sets real incarnation_count_for_pool_.
217 } 216 }
218 217
219 ThreadData::~ThreadData() {} 218 ThreadData::~ThreadData() {}
220 219
221 void ThreadData::PushToHeadOfList() { 220 void ThreadData::PushToHeadOfList() {
222 VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(&random_number_,
223 sizeof(random_number_));
224 // Toss in a hint of randomness (atop the uniniitalized value). 221 // Toss in a hint of randomness (atop the uniniitalized value).
225 random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0)); 222 random_number_ += static_cast<int32>(this - static_cast<ThreadData*>(0));
226 random_number_ ^= (Now() - TrackedTime()).InMilliseconds(); 223 random_number_ ^= (Now() - TrackedTime()).InMilliseconds();
227 224
228 DCHECK(!next_); 225 DCHECK(!next_);
229 base::AutoLock lock(*list_lock_.Pointer()); 226 base::AutoLock lock(*list_lock_.Pointer());
230 incarnation_count_for_pool_ = incarnation_counter_; 227 incarnation_count_for_pool_ = incarnation_counter_;
231 next_ = all_thread_data_list_head_; 228 next_ = all_thread_data_list_head_;
232 all_thread_data_list_head_ = this; 229 all_thread_data_list_head_ = this;
233 } 230 }
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 739
743 base::ListValue* DataCollector::ToValue() const { 740 base::ListValue* DataCollector::ToValue() const {
744 base::ListValue* list = new base::ListValue; 741 base::ListValue* list = new base::ListValue;
745 for (size_t i = 0; i < collection_.size(); ++i) { 742 for (size_t i = 0; i < collection_.size(); ++i) {
746 list->Append(collection_[i].ToValue()); 743 list->Append(collection_[i].ToValue());
747 } 744 }
748 return list; 745 return list;
749 } 746 }
750 747
751 } // namespace tracked_objects 748 } // namespace tracked_objects
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698