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

Unified Diff: components/precache/content/precache_manager.cc

Issue 2061303003: Precache should cancel when there is user traffic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 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
Index: components/precache/content/precache_manager.cc
diff --git a/components/precache/content/precache_manager.cc b/components/precache/content/precache_manager.cc
index 376c4579618c38b8059476dc98f87ce3fcc00689..9a81fbb032b3e47ee7de0748794ec3c30ea0c096 100644
--- a/components/precache/content/precache_manager.cc
+++ b/components/precache/content/precache_manager.cc
@@ -214,6 +214,21 @@ bool PrecacheManager::IsPrecaching() const {
return is_precaching_;
}
+void PrecacheManager::UpdatePrecacheMetricsAndState(
+ const GURL& url,
+ const GURL& referrer,
+ const base::TimeDelta& latency,
+ const base::Time& fetch_time,
+ int64_t size,
+ bool was_cached,
+ bool is_user_traffic) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ RecordStatsForFetch(url, referrer, latency, fetch_time, size, was_cached);
+ if (is_user_traffic && IsPrecaching())
+ CancelPrecaching();
+}
+
void PrecacheManager::RecordStatsForFetch(const GURL& url,
const GURL& referrer,
const base::TimeDelta& latency,

Powered by Google App Engine
This is Rietveld 408576698