Chromium Code Reviews| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/threading/thread_checker.h" | 20 #include "base/threading/thread_checker.h" |
| 21 #include "components/precache/core/precache_fetcher.h" | 21 #include "components/precache/core/precache_fetcher.h" |
| 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 #include "net/http/http_response_info.h" | |
|
bengr
2016/07/21 00:03:27
Forward declare instead.
| |
| 24 | 25 |
| 25 class GURL; | 26 class GURL; |
| 26 | 27 |
| 27 namespace base { | 28 namespace base { |
| 28 class FilePath; | 29 class FilePath; |
| 29 class Time; | 30 class Time; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace sql { | 33 namespace sql { |
| 33 class Connection; | 34 class Connection; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 56 void DeleteExpiredPrecacheHistory(const base::Time& current_time); | 57 void DeleteExpiredPrecacheHistory(const base::Time& current_time); |
| 57 | 58 |
| 58 // Delete all history entries from the database. | 59 // Delete all history entries from the database. |
| 59 void ClearHistory(); | 60 void ClearHistory(); |
| 60 | 61 |
| 61 // Report precache-related metrics in response to a URL being fetched, where | 62 // Report precache-related metrics in response to a URL being fetched, where |
| 62 // the fetch was motivated by precaching. | 63 // the fetch was motivated by precaching. |
| 63 void RecordURLPrefetch(const GURL& url, | 64 void RecordURLPrefetch(const GURL& url, |
| 64 const base::TimeDelta& latency, | 65 const base::TimeDelta& latency, |
| 65 const base::Time& fetch_time, | 66 const base::Time& fetch_time, |
| 66 int64_t size, | 67 const net::HttpResponseInfo& info, |
| 67 bool was_cached); | 68 int64_t size); |
| 68 | 69 |
| 69 // Report precache-related metrics in response to a URL being fetched, where | 70 // Report precache-related metrics in response to a URL being fetched, where |
| 70 // the fetch was not motivated by precaching. |is_connection_cellular| | 71 // the fetch was not motivated by precaching. |is_connection_cellular| |
| 71 // indicates whether the current network connection is a cellular network. | 72 // indicates whether the current network connection is a cellular network. |
| 72 void RecordURLNonPrefetch(const GURL& url, | 73 void RecordURLNonPrefetch(const GURL& url, |
| 73 const base::TimeDelta& latency, | 74 const base::TimeDelta& latency, |
| 74 const base::Time& fetch_time, | 75 const base::Time& fetch_time, |
| 76 const net::HttpResponseInfo& info, | |
| 75 int64_t size, | 77 int64_t size, |
| 76 bool was_cached, | |
| 77 int host_rank, | 78 int host_rank, |
| 78 bool is_connection_cellular); | 79 bool is_connection_cellular); |
| 79 | 80 |
| 80 // Gets the state required to continue a precache session. | 81 // Gets the state required to continue a precache session. |
| 81 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); | 82 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); |
| 82 | 83 |
| 83 // Stores the state required to continue a precache session so that the | 84 // Stores the state required to continue a precache session so that the |
| 84 // session can be resumed later. | 85 // session can be resumed later. |
| 85 void SaveUnfinishedWork( | 86 void SaveUnfinishedWork( |
| 86 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); | 87 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 base::ThreadChecker thread_checker_; | 137 base::ThreadChecker thread_checker_; |
| 137 | 138 |
| 138 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; | 139 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; |
| 139 | 140 |
| 140 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); | 141 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); |
| 141 }; | 142 }; |
| 142 | 143 |
| 143 } // namespace precache | 144 } // namespace precache |
| 144 | 145 |
| 145 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ | 146 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ |
| OLD | NEW |