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

Unified Diff: net/http/infinite_cache.cc

Issue 10959026: Http cache: Make sure we separate the infinite cache simulation from the real cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | « net/http/infinite_cache.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/infinite_cache.cc
===================================================================
--- net/http/infinite_cache.cc (revision 157450)
+++ net/http/infinite_cache.cc (working copy)
@@ -314,11 +314,14 @@
resource_data_->details.flags |= TRUNCATED;
}
-void InfiniteCacheTransaction::OnServedFromCache() {
+void InfiniteCacheTransaction::OnServedFromCache(
+ const HttpResponseInfo* response) {
if (!cache_)
return;
resource_data_->details.flags |= CACHED;
+ if (!resource_data_->details.last_access)
+ OnResponseReceived(response);
}
void InfiniteCacheTransaction::Finish() {
@@ -503,25 +506,21 @@
}
data->details.use_count = i->second.use_count;
data->details.update_count = i->second.update_count;
- if (data->details.flags & CACHED) {
- RecordHit(i->second, &data->details);
- } else {
- bool reused = CanReuse(i->second, data->details);
- bool data_changed = DataChanged(i->second, data->details);
- bool headers_changed = HeadersChanged(i->second, data->details);
+ bool reused = CanReuse(i->second, data->details);
+ bool data_changed = DataChanged(i->second, data->details);
+ bool headers_changed = HeadersChanged(i->second, data->details);
- if (reused && data_changed)
- header_->num_bad_hits++;
+ if (reused && data_changed)
+ header_->num_bad_hits++;
- if (reused)
- RecordHit(i->second, &data->details);
+ if (reused)
+ RecordHit(i->second, &data->details);
- if (headers_changed)
- UMA_HISTOGRAM_BOOLEAN("InfiniteCache.HeadersChange", true);
+ if (headers_changed)
+ UMA_HISTOGRAM_BOOLEAN("InfiniteCache.HeadersChange", true);
- if (data_changed)
- RecordUpdate(i->second, &data->details);
- }
+ if (data_changed)
+ RecordUpdate(i->second, &data->details);
if (data->details.flags & NO_STORE) {
Remove(i->second);
@@ -896,6 +895,9 @@
bool InfiniteCache::Worker::DataChanged(const Details& old,
const Details& current) {
+ if (current.flags & CACHED)
+ return false;
+
bool changed = false;
if (old.response_size != current.response_size) {
changed = true;
« no previous file with comments | « net/http/infinite_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698