| 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_CORE_PRECACHE_DATABASE_H_ | 5 #ifndef COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ |
| 6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ | 6 #define COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "components/precache/core/precache_session_table.h" | 22 #include "components/precache/core/precache_session_table.h" |
| 23 #include "components/precache/core/precache_url_table.h" | 23 #include "components/precache/core/precache_url_table.h" |
| 24 | 24 |
| 25 class GURL; | 25 class GURL; |
| 26 | 26 |
| 27 namespace base { | 27 namespace base { |
| 28 class FilePath; | 28 class FilePath; |
| 29 class Time; | 29 class Time; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace net { |
| 33 class HttpResponseInfo; |
| 34 } |
| 35 |
| 32 namespace sql { | 36 namespace sql { |
| 33 class Connection; | 37 class Connection; |
| 34 } | 38 } |
| 35 | 39 |
| 36 namespace precache { | 40 namespace precache { |
| 37 | 41 |
| 38 class PrecacheUnfinishedWork; | 42 class PrecacheUnfinishedWork; |
| 39 | 43 |
| 40 // Class that tracks information related to precaching. This class may be | 44 // Class that tracks information related to precaching. This class may be |
| 41 // constructed on any thread, but all calls to, and destruction of this class | 45 // constructed on any thread, but all calls to, and destruction of this class |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 | 64 |
| 61 // Setter and getter for the last precache timestamp. | 65 // Setter and getter for the last precache timestamp. |
| 62 void SetLastPrecacheTimestamp(const base::Time& time); | 66 void SetLastPrecacheTimestamp(const base::Time& time); |
| 63 base::Time GetLastPrecacheTimestamp(); | 67 base::Time GetLastPrecacheTimestamp(); |
| 64 | 68 |
| 65 // Report precache-related metrics in response to a URL being fetched, where | 69 // Report precache-related metrics in response to a URL being fetched, where |
| 66 // the fetch was motivated by precaching. | 70 // the fetch was motivated by precaching. |
| 67 void RecordURLPrefetch(const GURL& url, | 71 void RecordURLPrefetch(const GURL& url, |
| 68 const base::TimeDelta& latency, | 72 const base::TimeDelta& latency, |
| 69 const base::Time& fetch_time, | 73 const base::Time& fetch_time, |
| 70 int64_t size, | 74 const net::HttpResponseInfo& info, |
| 71 bool was_cached); | 75 int64_t size); |
| 72 | 76 |
| 73 // Report precache-related metrics in response to a URL being fetched, where | 77 // Report precache-related metrics in response to a URL being fetched, where |
| 74 // the fetch was not motivated by precaching. |is_connection_cellular| | 78 // the fetch was not motivated by precaching. |is_connection_cellular| |
| 75 // indicates whether the current network connection is a cellular network. | 79 // indicates whether the current network connection is a cellular network. |
| 76 void RecordURLNonPrefetch(const GURL& url, | 80 void RecordURLNonPrefetch(const GURL& url, |
| 77 const base::TimeDelta& latency, | 81 const base::TimeDelta& latency, |
| 78 const base::Time& fetch_time, | 82 const base::Time& fetch_time, |
| 83 const net::HttpResponseInfo& info, |
| 79 int64_t size, | 84 int64_t size, |
| 80 bool was_cached, | |
| 81 int host_rank, | 85 int host_rank, |
| 82 bool is_connection_cellular); | 86 bool is_connection_cellular); |
| 83 | 87 |
| 84 // Gets the state required to continue a precache session. | 88 // Gets the state required to continue a precache session. |
| 85 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); | 89 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); |
| 86 | 90 |
| 87 // Stores the state required to continue a precache session so that the | 91 // Stores the state required to continue a precache session so that the |
| 88 // session can be resumed later. | 92 // session can be resumed later. |
| 89 void SaveUnfinishedWork( | 93 void SaveUnfinishedWork( |
| 90 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); | 94 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 152 |
| 149 // This must be the last member of this class. | 153 // This must be the last member of this class. |
| 150 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; | 154 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; |
| 151 | 155 |
| 152 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); | 156 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); |
| 153 }; | 157 }; |
| 154 | 158 |
| 155 } // namespace precache | 159 } // namespace precache |
| 156 | 160 |
| 157 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ | 161 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ |
| OLD | NEW |