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

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

Issue 2061303003: Precache should cancel when there is user traffic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restructured Created 4 years, 6 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.h
diff --git a/components/precache/content/precache_manager.h b/components/precache/content/precache_manager.h
index 614ea0bd0b663d987d14371a516b984b491df4dd..ab4b695bfe345410b47812d99e65d372b936d538 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -96,18 +96,21 @@ class PrecacheManager : public KeyedService,
// Returns true if precaching is currently in progress, or false otherwise.
bool IsPrecaching() const;
- // Update precache-related metrics in response to a URL being fetched.
- void RecordStatsForFetch(const GURL& url,
- const GURL& referrer,
- const base::TimeDelta& latency,
- const base::Time& fetch_time,
- int64_t size,
- bool was_cached);
-
// Posts a task to the DB thread to delete all history entries from the
// database. Does not wait for completion of this task.
void ClearHistory();
+ // Update precache about an URL being fetched. Metrics related to precache are
+ // updated and any ongoing precache will be cancelled if this is an user
+ // initiated request. Should be called on UI thread.
+ void UpdatePrecacheMetricsAndState(const GURL& url,
+ const GURL& referrer,
+ base::TimeDelta latency,
bengr 2016/06/20 20:21:14 Forward declare. Also shouldn't this be a const ba
Raj 2016/06/30 06:03:08 Done.
+ const base::Time& fetch_time,
+ int64_t size,
+ bool was_cached,
+ bool is_user_traffic);
+
private:
enum class AllowedType {
ALLOWED,
@@ -138,6 +141,14 @@ class PrecacheManager : public KeyedService,
// Returns true if precaching is allowed for the browser context.
AllowedType PrecachingAllowed() const;
+ // Update precache-related metrics in response to a URL being fetched.
+ void RecordStatsForFetch(const GURL& url,
+ const GURL& referrer,
+ const base::TimeDelta& latency,
+ const base::Time& fetch_time,
+ int64_t size,
+ bool was_cached);
+
// Update precache-related metrics in response to a URL being fetched. Called
// by RecordStatsForFetch() by way of an asynchronous HistoryService callback.
void RecordStatsForFetchInternal(const GURL& url,

Powered by Google App Engine
This is Rietveld 408576698