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

Unified Diff: net/disk_cache/stats.cc

Issue 4292: Make sure there is only one instance of the stats histogram at a given time.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/stats.cc
===================================================================
--- net/disk_cache/stats.cc (revision 2604)
+++ net/disk_cache/stats.cc (working copy)
@@ -74,7 +74,7 @@
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 @@
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_));
« 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