Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(610)

Unified Diff: components/precache/core/precache_database.h

Issue 1961153003: Add pause/resume functionality to precache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/precache/core/fetcher_pool.h ('k') | components/precache/core/precache_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « components/precache/core/fetcher_pool.h ('k') | components/precache/core/precache_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698