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

Unified Diff: net/disk_cache/simple/simple_synchronous_entry.cc

Issue 23717040: Simple Cache: report age by (stream -> entry) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/simple/simple_synchronous_entry.cc
diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc
index 2dad511a58d24342b481dee39fa0b169639b66f5..a1ff1ac6adaab1664d6a61656ed1a1af93a0d308 100644
--- a/net/disk_cache/simple/simple_synchronous_entry.cc
+++ b/net/disk_cache/simple/simple_synchronous_entry.cc
@@ -520,6 +520,7 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles(
for (int i = 0; i < kSimpleEntryFileCount; ++i)
out_entry_stat->data_size[i] = 0;
} else {
+ base::TimeDelta entry_age = base::Time::Now() - base::Time::UnixEpoch();
for (int i = 0; i < kSimpleEntryFileCount; ++i) {
PlatformFileInfo file_info;
bool success = GetPlatformFileInfo(files_[i], &file_info);
@@ -534,16 +535,18 @@ bool SimpleSynchronousEntry::OpenOrCreateFiles(
else
out_entry_stat->last_modified = file_info.last_modified;
- base::TimeDelta entry_age =
+ base::TimeDelta stream_age =
base::Time::Now() - out_entry_stat->last_modified;
- SIMPLE_CACHE_UMA(CUSTOM_COUNTS,
- "SyncOpenEntryAge", cache_type_,
- entry_age.InHours(), 1, 1000, 50);
+ if (stream_age < entry_age)
+ entry_age = stream_age;
// Keep the file size in |data size_| briefly until the key is initialized
// properly.
out_entry_stat->data_size[i] = file_info.size;
}
+ SIMPLE_CACHE_UMA(CUSTOM_COUNTS,
+ "SyncOpenEntryAge", cache_type_,
+ entry_age.InHours(), 1, 1000, 50);
}
return true;
« 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