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> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/basictypes.h" | |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
16 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
17 #include "components/precache/core/precache_url_table.h" | 19 #include "components/precache/core/precache_url_table.h" |
18 | 20 |
19 class GURL; | 21 class GURL; |
20 | 22 |
21 namespace base { | 23 namespace base { |
22 class FilePath; | 24 class FilePath; |
23 class Time; | 25 class Time; |
(...skipping 22 matching lines...) Expand all Loading... |
46 void DeleteExpiredPrecacheHistory(const base::Time& current_time); | 48 void DeleteExpiredPrecacheHistory(const base::Time& current_time); |
47 | 49 |
48 // Delete all history entries from the database. | 50 // Delete all history entries from the database. |
49 void ClearHistory(); | 51 void ClearHistory(); |
50 | 52 |
51 // Report precache-related metrics in response to a URL being fetched, where | 53 // Report precache-related metrics in response to a URL being fetched, where |
52 // the fetch was motivated by precaching. | 54 // the fetch was motivated by precaching. |
53 void RecordURLPrefetch(const GURL& url, | 55 void RecordURLPrefetch(const GURL& url, |
54 const base::TimeDelta& latency, | 56 const base::TimeDelta& latency, |
55 const base::Time& fetch_time, | 57 const base::Time& fetch_time, |
56 int64 size, | 58 int64_t size, |
57 bool was_cached); | 59 bool was_cached); |
58 | 60 |
59 // Report precache-related metrics in response to a URL being fetched, where | 61 // Report precache-related metrics in response to a URL being fetched, where |
60 // the fetch was not motivated by precaching. |is_connection_cellular| | 62 // the fetch was not motivated by precaching. |is_connection_cellular| |
61 // indicates whether the current network connection is a cellular network. | 63 // indicates whether the current network connection is a cellular network. |
62 void RecordURLNonPrefetch(const GURL& url, | 64 void RecordURLNonPrefetch(const GURL& url, |
63 const base::TimeDelta& latency, | 65 const base::TimeDelta& latency, |
64 const base::Time& fetch_time, | 66 const base::Time& fetch_time, |
65 int64 size, | 67 int64_t size, |
66 bool was_cached, | 68 bool was_cached, |
67 int host_rank, | 69 int host_rank, |
68 bool is_connection_cellular); | 70 bool is_connection_cellular); |
69 | 71 |
70 private: | 72 private: |
71 friend class base::RefCountedThreadSafe<PrecacheDatabase>; | 73 friend class base::RefCountedThreadSafe<PrecacheDatabase>; |
72 friend class PrecacheDatabaseTest; | 74 friend class PrecacheDatabaseTest; |
73 | 75 |
74 ~PrecacheDatabase(); | 76 ~PrecacheDatabase(); |
75 | 77 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // ThreadChecker used to ensure that all methods other than the constructor | 112 // ThreadChecker used to ensure that all methods other than the constructor |
111 // or destructor are called on the same thread. | 113 // or destructor are called on the same thread. |
112 base::ThreadChecker thread_checker_; | 114 base::ThreadChecker thread_checker_; |
113 | 115 |
114 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); | 116 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); |
115 }; | 117 }; |
116 | 118 |
117 } // namespace precache | 119 } // namespace precache |
118 | 120 |
119 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ | 121 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ |
OLD | NEW |