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

Unified Diff: components/precache/content/precache_manager.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/content/BUILD.gn ('k') | components/precache/content/precache_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/precache/content/precache_manager.h
diff --git a/components/precache/content/precache_manager.h b/components/precache/content/precache_manager.h
index dde145a3040f74b5c32b115d0b4c88ef79d926d9..614ea0bd0b663d987d14371a516b984b491df4dd 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -24,6 +24,7 @@
#include "url/gurl.h"
namespace base {
+class FilePath;
class Time;
}
@@ -42,6 +43,7 @@ class SyncService;
namespace precache {
class PrecacheDatabase;
+class PrecacheUnfinishedWork;
// Visible for test.
size_t NumTopHosts();
@@ -61,7 +63,9 @@ class PrecacheManager : public KeyedService,
PrecacheManager(content::BrowserContext* browser_context,
const sync_driver::SyncService* const sync_service,
- const history::HistoryService* const history_service);
+ const history::HistoryService* const history_service,
+ const base::FilePath& db_path,
+ std::unique_ptr<PrecacheDatabase> precache_database);
~PrecacheManager() override;
// Returns true if the client is in the experiment group -- that is,
@@ -117,9 +121,16 @@ class PrecacheManager : public KeyedService,
// From PrecacheFetcher::PrecacheDelegate.
void OnDone() override;
+ // Callback when fetching unfinished work from storage is done.
+ void OnGetUnfinishedWorkDone(
+ std::unique_ptr<PrecacheUnfinishedWork> unfinished_work);
+
// From history::HistoryService::TopHosts.
void OnHostsReceived(const history::TopHostsList& host_counts);
+ // Initializes and Starts a PrecacheFetcher with unfinished work.
+ void InitializeAndStartFetcher();
+
// From history::HistoryService::TopHosts. Used for the control group, which
// gets the list of TopHosts for metrics purposes, but otherwise does nothing.
void OnHostsReceivedThenDone(const history::TopHostsList& host_counts);
@@ -162,6 +173,9 @@ class PrecacheManager : public KeyedService,
// Flag indicating whether or not precaching is currently in progress.
bool is_precaching_;
+ // Work that hasn't yet finished.
+ std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_;
+
DISALLOW_COPY_AND_ASSIGN(PrecacheManager);
};
« no previous file with comments | « components/precache/content/BUILD.gn ('k') | components/precache/content/precache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698