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

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

Issue 28046: Use string for Histogram names since these are all ASCII anyway wide-characte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/rankings.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/eviction.h" 5 #include "net/disk_cache/eviction.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (++deleted == 4 && !empty) { 73 if (++deleted == 4 && !empty) {
74 #if defined(OS_WIN) 74 #if defined(OS_WIN)
75 MessageLoop::current()->PostTask(FROM_HERE, 75 MessageLoop::current()->PostTask(FROM_HERE,
76 factory_.NewRunnableMethod(&Eviction::TrimCache, false)); 76 factory_.NewRunnableMethod(&Eviction::TrimCache, false));
77 break; 77 break;
78 #endif 78 #endif
79 } 79 }
80 } 80 }
81 } 81 }
82 82
83 UMA_HISTOGRAM_TIMES(L"DiskCache.TotalTrimTime", Time::Now() - start); 83 UMA_HISTOGRAM_TIMES("DiskCache.TotalTrimTime", Time::Now() - start);
84 Trace("*** Trim Cache end ***"); 84 Trace("*** Trim Cache end ***");
85 return; 85 return;
86 } 86 }
87 87
88 void Eviction::UpdateRank(EntryImpl* entry, bool modified) { 88 void Eviction::UpdateRank(EntryImpl* entry, bool modified) {
89 rankings_->UpdateRank(entry->rankings(), modified, GetListForEntry(entry)); 89 rankings_->UpdateRank(entry->rankings(), modified, GetListForEntry(entry));
90 } 90 }
91 91
92 void Eviction::OnOpenEntry(EntryImpl* entry) { 92 void Eviction::OnOpenEntry(EntryImpl* entry) {
93 } 93 }
94 94
95 void Eviction::OnCreateEntry(EntryImpl* entry) { 95 void Eviction::OnCreateEntry(EntryImpl* entry) {
96 rankings_->Insert(entry->rankings(), true, GetListForEntry(entry)); 96 rankings_->Insert(entry->rankings(), true, GetListForEntry(entry));
97 } 97 }
98 98
99 void Eviction::OnDoomEntry(EntryImpl* entry) { 99 void Eviction::OnDoomEntry(EntryImpl* entry) {
100 rankings_->Remove(entry->rankings(), GetListForEntry(entry)); 100 rankings_->Remove(entry->rankings(), GetListForEntry(entry));
101 } 101 }
102 102
103 void Eviction::OnDestroyEntry(EntryImpl* entry) { 103 void Eviction::OnDestroyEntry(EntryImpl* entry) {
104 } 104 }
105 105
106 void Eviction::ReportTrimTimes(EntryImpl* entry) { 106 void Eviction::ReportTrimTimes(EntryImpl* entry) {
107 static bool first_time = true; 107 static bool first_time = true;
108 if (first_time) { 108 if (first_time) {
109 first_time = false; 109 first_time = false;
110 std::wstring name(StringPrintf(L"DiskCache.TrimAge_%d", 110 std::string name(StringPrintf("DiskCache.TrimAge_%d",
111 header_->experiment)); 111 header_->experiment));
112 static Histogram counter(name.c_str(), 1, 10000, 50); 112 static Histogram counter(name.c_str(), 1, 10000, 50);
113 counter.SetFlags(kUmaTargetedHistogramFlag); 113 counter.SetFlags(kUmaTargetedHistogramFlag);
114 counter.Add((Time::Now() - entry->GetLastUsed()).InHours()); 114 counter.Add((Time::Now() - entry->GetLastUsed()).InHours());
115 } 115 }
116 } 116 }
117 117
118 Rankings::List Eviction::GetListForEntry(EntryImpl* entry) { 118 Rankings::List Eviction::GetListForEntry(EntryImpl* entry) {
119 return Rankings::NO_USE; 119 return Rankings::NO_USE;
120 } 120 }
121 121
122 } // namespace disk_cache 122 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/entry_impl.cc ('k') | net/disk_cache/rankings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698