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

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

Issue 2202023002: Precache should cancel when there is user traffic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: 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 7457018f6b559b60d967bc13fc82615f61371281..2f896f3e3b9194778e4e11bd4403c55fa48c5a95 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,
« no previous file with comments | « components/precache/content/precache_manager.h ('k') | components/precache/content/precache_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698