diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 16:00:41 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 16:00:41 +0000 |
commit | 05a81412f30cc6ee91dc2ffb3205f24deaaac54d (patch) | |
tree | 6fa2d8657e8daaf4af3d995cb0a04224561e6155 /net/disk_cache | |
parent | 23e152e917c70e0399770433d564fe2f54c5ea95 (diff) | |
download | chromium_src-05a81412f30cc6ee91dc2ffb3205f24deaaac54d.zip chromium_src-05a81412f30cc6ee91dc2ffb3205f24deaaac54d.tar.gz chromium_src-05a81412f30cc6ee91dc2ffb3205f24deaaac54d.tar.bz2 |
Move flags initialization into block before sharing across threads
We re-initialized the flags after we shared the histograms, so
there was a potential race for multiple simultaneous initializations.
This change completes the basic setting of the flags prior to
registration, which in turn shares the histogram across threads.
There was a potential race with the (later) setting of the flag
during an upload from the renderer. With the new code, the flag
is const except for its potential change by the renderer-serialization
routine, which is also the only consumer of this flag (in
the renderer).
I also made the corresponding change to stats_histogram, even
though the code was already at least as correct, as I wanted
the patterns of use to remain analagous.
r=rvargas,rtenneti
BUG=77760
Review URL: http://codereview.chromium.org/6731074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/stats_histogram.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/disk_cache/stats_histogram.cc b/net/disk_cache/stats_histogram.cc index d859899..e9d7696 100644 --- a/net/disk_cache/stats_histogram.cc +++ b/net/disk_cache/stats_histogram.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,6 +36,7 @@ scoped_refptr<StatsHistogram> StatsHistogram::StatsHistogramFactoryGet( bucket_count); stats_histogram->InitializeBucketRange(); histogram = stats_histogram; + histogram->SetFlags(kUmaTargetedHistogramFlag); StatisticsRecorder::RegisterOrDiscardDuplicate(&histogram); } @@ -59,8 +60,6 @@ bool StatsHistogram::Init(const Stats* stats) { if (stats_) return false; - SetFlags(kUmaTargetedHistogramFlag); - // We support statistics report for only one cache. init_ = true; stats_ = stats; |