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 <memory> | 10 #include <memory> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); | 108 std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); |
109 | 109 |
110 // Stores the state required to continue a precache session so that the | 110 // Stores the state required to continue a precache session so that the |
111 // session can be resumed later. | 111 // session can be resumed later. |
112 void SaveUnfinishedWork( | 112 void SaveUnfinishedWork( |
113 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); | 113 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); |
114 | 114 |
115 // Deletes unfinished work from the database. | 115 // Deletes unfinished work from the database. |
116 void DeleteUnfinishedWork(); | 116 void DeleteUnfinishedWork(); |
117 | 117 |
| 118 // Precache quota. |
| 119 void SaveQuota(const PrecacheQuota& quota); |
| 120 PrecacheQuota GetQuota(); |
| 121 |
118 base::WeakPtr<PrecacheDatabase> GetWeakPtr(); | 122 base::WeakPtr<PrecacheDatabase> GetWeakPtr(); |
119 | 123 |
120 private: | 124 private: |
121 friend class PrecacheDatabaseTest; | 125 friend class PrecacheDatabaseTest; |
122 | 126 |
123 bool IsDatabaseAccessible() const; | 127 bool IsDatabaseAccessible() const; |
124 | 128 |
125 // Flushes any buffered write operations. |buffered_writes_| will be empty | 129 // Flushes any buffered write operations. |buffered_writes_| will be empty |
126 // after calling this function. To maximize performance, all the buffered | 130 // after calling this function. To maximize performance, all the buffered |
127 // writes are run in a single database transaction. | 131 // writes are run in a single database transaction. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 188 |
185 // This must be the last member of this class. | 189 // This must be the last member of this class. |
186 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; | 190 base::WeakPtrFactory<PrecacheDatabase> weak_factory_; |
187 | 191 |
188 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); | 192 DISALLOW_COPY_AND_ASSIGN(PrecacheDatabase); |
189 }; | 193 }; |
190 | 194 |
191 } // namespace precache | 195 } // namespace precache |
192 | 196 |
193 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ | 197 #endif // COMPONENTS_PRECACHE_CORE_PRECACHE_DATABASE_H_ |
OLD | NEW |