diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 00:10:30 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 00:10:30 +0000 |
commit | 80875ac1d30c8af55305a8e766c761f22b1e772c (patch) | |
tree | eb56bd69bb9815eb29decfb691f69bec18f7e7bc /net/disk_cache | |
parent | 4ec7ed7a1cbd5c589ac4f3761ac9010b1bc83176 (diff) | |
download | chromium_src-80875ac1d30c8af55305a8e766c761f22b1e772c.zip chromium_src-80875ac1d30c8af55305a8e766c761f22b1e772c.tar.gz chromium_src-80875ac1d30c8af55305a8e766c761f22b1e772c.tar.bz2 |
Make sure there is only one instance of the stats histogram at a given time.
BUG=2805
Review URL: http://codereview.chromium.org/4292
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/stats.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc index 83448d5..7c49e5c 100644 --- a/net/disk_cache/stats.cc +++ b/net/disk_cache/stats.cc @@ -74,7 +74,7 @@ bool LoadStats(BackendImpl* backend, Addr address, OnDiskStats* stats) { if (stats->signature != kDiskSignature) return false; - // We don't want to discard the whole cache everytime we have one extra + // We don't want to discard the whole cache every time we have one extra // counter; just reset them to zero. if (stats->size != sizeof(*stats)) memset(stats, 0, sizeof(*stats)); @@ -120,8 +120,12 @@ bool Stats::Init(BackendImpl* backend, uint32* storage_addr) { storage_addr_ = address.value(); backend_ = backend; - size_histogram_.reset(new StatsHistogram(L"DiskCache.SizeStats")); - size_histogram_->Init(this); + if (!size_histogram_.get()) { + // Stats may be reused when the cache is re-created, but we want only one + // histogram at any given time. + size_histogram_.reset(new StatsHistogram(L"DiskCache.SizeStats")); + size_histogram_->Init(this); + } memcpy(data_sizes_, stats.data_sizes, sizeof(data_sizes_)); memcpy(counters_, stats.counters, sizeof(counters_)); |