diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-27 20:12:34 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-27 20:12:34 +0000 |
commit | 17a8396f14051151059e95ce14b8a3e27b7c5882 (patch) | |
tree | 01f45ab023a8115f552f81a21da3b5f6cbfd4aa0 /net/disk_cache/stats.cc | |
parent | 63088d3724219e46dfa72818249553bbb6781345 (diff) | |
download | chromium_src-17a8396f14051151059e95ce14b8a3e27b7c5882.zip chromium_src-17a8396f14051151059e95ce14b8a3e27b7c5882.tar.gz chromium_src-17a8396f14051151059e95ce14b8a3e27b7c5882.tar.bz2 |
Disk Cache: Second pass (and final) to allow multiple instances
of BackendImpl.
This cl takes care of all the histograms on the disk cache. Most
of them have to be splitted in three so that we get separate data
from different cache types. There are a few places where the complexity
of splitting the histogram is not worth it so we just keep either all
data together (if it makes sense), or just ignore data for some types of
caches.
note: Having multiple versions of a histogram but only one "active" for a
given client is not the same as having multiple histograms working at the
same time for different objects.
Review URL: http://codereview.chromium.org/42682
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/stats.cc')
-rw-r--r-- | net/disk_cache/stats.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc index 4f9440e..702b2a36 100644 --- a/net/disk_cache/stats.cc +++ b/net/disk_cache/stats.cc @@ -123,16 +123,25 @@ bool Stats::Init(BackendImpl* backend, uint32* storage_addr) { storage_addr_ = address.value(); backend_ = backend; - 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("DiskCache.SizeStats")); - size_histogram_->Init(this); - } memcpy(data_sizes_, stats.data_sizes, sizeof(data_sizes_)); memcpy(counters_, stats.counters, sizeof(counters_)); + // It seems impossible to support this histogram for more than one + // simultaneous objects with the current infrastructure. + static bool first_time = true; + if (first_time) { + first_time = false; + // ShouldReportAgain() will re-enter this object. + if (!size_histogram_.get() && backend->cache_type() == net::DISK_CACHE && + backend->ShouldReportAgain()) { + // 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("DiskCache.SizeStats")); + size_histogram_->Init(this); + } + } + return true; } |