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

Side by Side Diff: components/precache/content/precache_manager.h

Issue 2146023003: Add UMA Precache.Freshness.Prefetch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing includes Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 5 #ifndef COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
6 #define COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 6 #define COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 class BrowserContext; 33 class BrowserContext;
34 } 34 }
35 35
36 namespace history { 36 namespace history {
37 class HistoryService; 37 class HistoryService;
38 } 38 }
39 39
40 namespace net {
41 class HttpResponseInfo;
42 }
43
40 namespace sync_driver { 44 namespace sync_driver {
41 class SyncService; 45 class SyncService;
42 } 46 }
43 47
44 namespace precache { 48 namespace precache {
45 49
46 class PrecacheDatabase; 50 class PrecacheDatabase;
47 class PrecacheUnfinishedWork; 51 class PrecacheUnfinishedWork;
48 52
49 // Visible for test. 53 // Visible for test.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // database. Does not wait for completion of this task. 105 // database. Does not wait for completion of this task.
102 void ClearHistory(); 106 void ClearHistory();
103 107
104 // Update precache about an URL being fetched. Metrics related to precache are 108 // Update precache about an URL being fetched. Metrics related to precache are
105 // updated and any ongoing precache will be cancelled if this is an user 109 // updated and any ongoing precache will be cancelled if this is an user
106 // initiated request. Should be called on UI thread. 110 // initiated request. Should be called on UI thread.
107 void UpdatePrecacheMetricsAndState(const GURL& url, 111 void UpdatePrecacheMetricsAndState(const GURL& url,
108 const GURL& referrer, 112 const GURL& referrer,
109 const base::TimeDelta& latency, 113 const base::TimeDelta& latency,
110 const base::Time& fetch_time, 114 const base::Time& fetch_time,
115 const net::HttpResponseInfo& info,
111 int64_t size, 116 int64_t size,
112 bool was_cached,
113 bool is_user_traffic); 117 bool is_user_traffic);
114 118
115 private: 119 private:
116 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, DeleteExpiredPrecacheHistory); 120 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, DeleteExpiredPrecacheHistory);
117 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, 121 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest,
118 RecordStatsForFetchDuringPrecaching); 122 RecordStatsForFetchDuringPrecaching);
119 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTP); 123 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTP);
120 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTPS); 124 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTPS);
121 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchInTopHosts); 125 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchInTopHosts);
122 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, 126 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest,
(...skipping 29 matching lines...) Expand all
152 void OnHostsReceivedThenDone(const history::TopHostsList& host_counts); 156 void OnHostsReceivedThenDone(const history::TopHostsList& host_counts);
153 157
154 // Returns true if precaching is allowed for the browser context. 158 // Returns true if precaching is allowed for the browser context.
155 AllowedType PrecachingAllowed() const; 159 AllowedType PrecachingAllowed() const;
156 160
157 // Update precache-related metrics in response to a URL being fetched. 161 // Update precache-related metrics in response to a URL being fetched.
158 void RecordStatsForFetch(const GURL& url, 162 void RecordStatsForFetch(const GURL& url,
159 const GURL& referrer, 163 const GURL& referrer,
160 const base::TimeDelta& latency, 164 const base::TimeDelta& latency,
161 const base::Time& fetch_time, 165 const base::Time& fetch_time,
162 int64_t size, 166 const net::HttpResponseInfo& info,
163 bool was_cached); 167 int64_t size);
164 168
165 // Update precache-related metrics in response to a URL being fetched. Called 169 // Update precache-related metrics in response to a URL being fetched. Called
166 // by RecordStatsForFetch() by way of an asynchronous HistoryService callback. 170 // by RecordStatsForFetch() by way of an asynchronous HistoryService callback.
167 void RecordStatsForFetchInternal(const GURL& url, 171 void RecordStatsForFetchInternal(const GURL& url,
168 const base::TimeDelta& latency, 172 const base::TimeDelta& latency,
169 const base::Time& fetch_time, 173 const base::Time& fetch_time,
174 const net::HttpResponseInfo& info,
170 int64_t size, 175 int64_t size,
171 bool was_cached,
172 int host_rank); 176 int host_rank);
173 177
174 // The browser context that owns this PrecacheManager. 178 // The browser context that owns this PrecacheManager.
175 content::BrowserContext* const browser_context_; 179 content::BrowserContext* const browser_context_;
176 180
177 // The sync service corresponding to the browser context. Used to determine 181 // The sync service corresponding to the browser context. Used to determine
178 // whether precache can run. May be null. 182 // whether precache can run. May be null.
179 const sync_driver::SyncService* const sync_service_; 183 const sync_driver::SyncService* const sync_service_;
180 184
181 // The history service corresponding to the browser context. Used to determine 185 // The history service corresponding to the browser context. Used to determine
(...skipping 17 matching lines...) Expand all
199 203
200 // Work that hasn't yet finished. 204 // Work that hasn't yet finished.
201 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_; 205 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_;
202 206
203 DISALLOW_COPY_AND_ASSIGN(PrecacheManager); 207 DISALLOW_COPY_AND_ASSIGN(PrecacheManager);
204 }; 208 };
205 209
206 } // namespace precache 210 } // namespace precache
207 211
208 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 212 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/precache/precache_util.cc ('k') | components/precache/content/precache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698