| 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..259ced7678a585fbac5d62d569a4efd0fe06eebf 100644
|
| --- a/components/precache/content/precache_manager.h
|
| +++ b/components/precache/content/precache_manager.h
|
| @@ -26,6 +26,7 @@
|
| namespace base {
|
| class FilePath;
|
| class Time;
|
| +class TimeDelta;
|
| }
|
|
|
| namespace content {
|
| @@ -96,19 +97,34 @@ 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,
|
| + const base::TimeDelta& latency,
|
| + const base::Time& fetch_time,
|
| + int64_t size,
|
| + bool was_cached,
|
| + bool is_user_traffic);
|
| +
|
| private:
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, DeleteExpiredPrecacheHistory);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest,
|
| + RecordStatsForFetchDuringPrecaching);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTP);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTPS);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchInTopHosts);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest,
|
| + RecordStatsForFetchWithEmptyURL);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchWithNonHTTP);
|
| + FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest,
|
| + RecordStatsForFetchWithSizeZero);
|
| +
|
| enum class AllowedType {
|
| ALLOWED,
|
| DISALLOWED,
|
| @@ -138,6 +154,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,
|
|
|