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

Side by Side Diff: net/disk_cache/stats.cc

Issue 7071035: Revert 86990 - Fix http://codereview.chromium.org/6869009 to ignore an existing object exactly on... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/metrics/histogram.cc ('k') | net/disk_cache/stats_histogram.h » ('j') | 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 "net/disk_cache/stats.h" 5 #include "net/disk_cache/stats.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // simultaneous objects with the current infrastructure. 144 // simultaneous objects with the current infrastructure.
145 static bool first_time = true; 145 static bool first_time = true;
146 if (first_time) { 146 if (first_time) {
147 first_time = false; 147 first_time = false;
148 // ShouldReportAgain() will re-enter this object. 148 // ShouldReportAgain() will re-enter this object.
149 if (!size_histogram_ && backend->cache_type() == net::DISK_CACHE && 149 if (!size_histogram_ && backend->cache_type() == net::DISK_CACHE &&
150 backend->ShouldReportAgain()) { 150 backend->ShouldReportAgain()) {
151 // Stats may be reused when the cache is re-created, but we want only one 151 // Stats may be reused when the cache is re-created, but we want only one
152 // histogram at any given time. 152 // histogram at any given time.
153 size_histogram_ = 153 size_histogram_ =
154 StatsHistogram::FactoryGet("DiskCache.SizeStats"); 154 StatsHistogram::StatsHistogramFactoryGet("DiskCache.SizeStats");
155 size_histogram_->Init(this); 155 size_histogram_->Init(this);
156 } 156 }
157 } 157 }
158 158
159 return true; 159 return true;
160 } 160 }
161 161
162 void Stats::ModifyStorageStats(int32 old_size, int32 new_size) { 162 void Stats::ModifyStorageStats(int32 old_size, int32 new_size) {
163 // We keep a counter of the data block size on an array where each entry is 163 // We keep a counter of the data block size on an array where each entry is
164 // the adjusted log base 2 of the size. The first entry counts blocks of 256 164 // the adjusted log base 2 of the size. The first entry counts blocks of 256
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 int Stats::GetRatio(Counters hit, Counters miss) const { 320 int Stats::GetRatio(Counters hit, Counters miss) const {
321 int64 ratio = GetCounter(hit) * 100; 321 int64 ratio = GetCounter(hit) * 100;
322 if (!ratio) 322 if (!ratio)
323 return 0; 323 return 0;
324 324
325 ratio /= (GetCounter(hit) + GetCounter(miss)); 325 ratio /= (GetCounter(hit) + GetCounter(miss));
326 return static_cast<int>(ratio); 326 return static_cast<int>(ratio);
327 } 327 }
328 328
329 } // namespace disk_cache 329 } // namespace disk_cache
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | net/disk_cache/stats_histogram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698