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

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: Cleaned up PrecacheFetcher constructor 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
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..6cbaf7a858ab8dadc5a77f2369f9894e95c9235c 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -61,7 +61,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,
+ std::unique_ptr<PrecacheDatabase> precache_database,
+ const base::FilePath& db_path);
~PrecacheManager() override;
// Returns true if the client is in the experiment group -- that is,
@@ -117,9 +119,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 +171,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);
};

Powered by Google App Engine
This is Rietveld 408576698