Index: components/precache/core/precache_database.h |
diff --git a/components/precache/core/precache_database.h b/components/precache/core/precache_database.h |
index 94d045107b83c744dae7d00bf50e5dcdcedd826b..aaea1ca9bbc005fec56820e787c0038a8b80df3e 100644 |
--- a/components/precache/core/precache_database.h |
+++ b/components/precache/core/precache_database.h |
@@ -7,6 +7,7 @@ |
#include <stdint.h> |
+#include <list> |
#include <memory> |
#include <string> |
#include <vector> |
@@ -14,8 +15,11 @@ |
#include "base/callback.h" |
#include "base/containers/hash_tables.h" |
#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
#include "base/threading/thread_checker.h" |
+#include "components/precache/core/precache_fetcher.h" |
+#include "components/precache/core/precache_session_table.h" |
#include "components/precache/core/precache_url_table.h" |
class GURL; |
@@ -31,6 +35,8 @@ class Connection; |
namespace precache { |
+class PrecacheUnfinishedWork; |
+ |
// Class that tracks information related to precaching. This class may be |
// constructed on any thread, but all calls to, and destruction of this class |
// must be done on the the DB thread. |
@@ -71,6 +77,19 @@ class PrecacheDatabase { |
int host_rank, |
bool is_connection_cellular); |
+ // Gets the state required to continue a precache session. |
+ std::unique_ptr<PrecacheUnfinishedWork> GetUnfinishedWork(); |
+ |
+ // Stores the state required to continue a precache session so that the |
+ // session can be resumed later. |
+ void SaveUnfinishedWork( |
+ std::unique_ptr<PrecacheUnfinishedWork> unfinished_work); |
+ |
+ // Deletes unfinished work from the database. |
+ void DeleteUnfinishedWork(); |
+ |
+ base::WeakPtr<PrecacheDatabase> GetWeakPtr(); |
+ |
private: |
friend class PrecacheDatabaseTest; |
@@ -97,6 +116,10 @@ class PrecacheDatabase { |
// then this table will not be up to date until the next call to Flush(). |
PrecacheURLTable precache_url_table_; |
+ // Table that persists state related to a precache session, including |
+ // unfinished work to be done. |
+ PrecacheSessionTable precache_session_table_; |
+ |
// A vector of write operations to be run on the database. |
std::vector<base::Closure> buffered_writes_; |