| OLD | NEW |
| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // initiated request. Should be called on UI thread. | 110 // initiated request. Should be called on UI thread. |
| 111 void UpdatePrecacheMetricsAndState(const GURL& url, | 111 void UpdatePrecacheMetricsAndState(const GURL& url, |
| 112 const GURL& referrer, | 112 const GURL& referrer, |
| 113 const base::TimeDelta& latency, | 113 const base::TimeDelta& latency, |
| 114 const base::Time& fetch_time, | 114 const base::Time& fetch_time, |
| 115 const net::HttpResponseInfo& info, | 115 const net::HttpResponseInfo& info, |
| 116 int64_t size, | 116 int64_t size, |
| 117 bool is_user_traffic); | 117 bool is_user_traffic); |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 friend class PrecacheManagerTest; |
| 120 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, DeleteExpiredPrecacheHistory); | 121 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, DeleteExpiredPrecacheHistory); |
| 121 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, | 122 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, |
| 122 RecordStatsForFetchDuringPrecaching); | 123 RecordStatsForFetchDuringPrecaching); |
| 123 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTP); | 124 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTP); |
| 124 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTPS); | 125 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchHTTPS); |
| 125 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchInTopHosts); | 126 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchInTopHosts); |
| 126 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, | 127 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, |
| 127 RecordStatsForFetchWithEmptyURL); | 128 RecordStatsForFetchWithEmptyURL); |
| 128 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchWithNonHTTP); | 129 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, RecordStatsForFetchWithNonHTTP); |
| 129 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, | 130 FRIEND_TEST_ALL_PREFIXES(PrecacheManagerTest, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 void RecordStatsForFetch(const GURL& url, | 163 void RecordStatsForFetch(const GURL& url, |
| 163 const GURL& referrer, | 164 const GURL& referrer, |
| 164 const base::TimeDelta& latency, | 165 const base::TimeDelta& latency, |
| 165 const base::Time& fetch_time, | 166 const base::Time& fetch_time, |
| 166 const net::HttpResponseInfo& info, | 167 const net::HttpResponseInfo& info, |
| 167 int64_t size); | 168 int64_t size); |
| 168 | 169 |
| 169 // Update precache-related metrics in response to a URL being fetched. Called | 170 // Update precache-related metrics in response to a URL being fetched. Called |
| 170 // by RecordStatsForFetch() by way of an asynchronous HistoryService callback. | 171 // by RecordStatsForFetch() by way of an asynchronous HistoryService callback. |
| 171 void RecordStatsForFetchInternal(const GURL& url, | 172 void RecordStatsForFetchInternal(const GURL& url, |
| 173 const std::string& referrer_host, |
| 172 const base::TimeDelta& latency, | 174 const base::TimeDelta& latency, |
| 173 const base::Time& fetch_time, | 175 const base::Time& fetch_time, |
| 174 const net::HttpResponseInfo& info, | 176 const net::HttpResponseInfo& info, |
| 175 int64_t size, | 177 int64_t size, |
| 176 int host_rank); | 178 int host_rank); |
| 177 | 179 |
| 178 // The browser context that owns this PrecacheManager. | 180 // The browser context that owns this PrecacheManager. |
| 179 content::BrowserContext* const browser_context_; | 181 content::BrowserContext* const browser_context_; |
| 180 | 182 |
| 181 // The sync service corresponding to the browser context. Used to determine | 183 // The sync service corresponding to the browser context. Used to determine |
| (...skipping 21 matching lines...) Expand all Loading... |
| 203 | 205 |
| 204 // Work that hasn't yet finished. | 206 // Work that hasn't yet finished. |
| 205 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_; | 207 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_; |
| 206 | 208 |
| 207 DISALLOW_COPY_AND_ASSIGN(PrecacheManager); | 209 DISALLOW_COPY_AND_ASSIGN(PrecacheManager); |
| 208 }; | 210 }; |
| 209 | 211 |
| 210 } // namespace precache | 212 } // namespace precache |
| 211 | 213 |
| 212 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ | 214 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ |
| OLD | NEW |