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

Unified Diff: components/precache/content/precache_manager.h

Issue 1272443002: Only set precache.last_time when precache ran. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filter_stats
Patch Set: Don't retry often unless backend pending. Created 5 years, 4 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 912a41fc055467bd7689ea344427c34f2ff79150..e0498d0c63c8ba97cc5f2b4199849c5e3af3054d 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -54,7 +54,7 @@ class PrecacheManager : public KeyedService,
public PrecacheFetcher::PrecacheDelegate,
public base::SupportsWeakPtr<PrecacheManager> {
public:
- typedef base::Closure PrecacheCompletionCallback;
+ typedef base::Callback<void(bool)> PrecacheCompletionCallback;
PrecacheManager(content::BrowserContext* browser_context,
const sync_driver::SyncService* const sync_service);
@@ -71,8 +71,9 @@ class PrecacheManager : public KeyedService,
// Starts precaching resources that the user is predicted to fetch in the
// future. If precaching is already currently in progress, then this method
- // does nothing. The |precache_completion_callback| will be run when
- // precaching finishes, but will not be run if precaching is canceled.
+ // does nothing. The |precache_completion_callback| will be passed true when
+ // precaching finishes, and passed false when precaching abort due to failed
+ // preconditions, but will not be run if precaching is canceled.
void StartPrecaching(
const PrecacheCompletionCallback& precache_completion_callback,
const history::HistoryService& history_service);
@@ -94,6 +95,12 @@ class PrecacheManager : public KeyedService,
void ClearHistory();
private:
+ enum class AllowedType {
+ ALLOWED,
+ DISALLOWED,
+ PENDING
+ };
+
// From KeyedService.
void Shutdown() override;
@@ -110,7 +117,7 @@ class PrecacheManager : public KeyedService,
static bool IsPrecachingEnabled();
// Returns true if precaching is allowed for the browser context.
- bool IsPrecachingAllowed() const;
+ AllowedType PrecachingAllowed() const;
// The browser context that owns this PrecacheManager.
content::BrowserContext* const browser_context_;

Powered by Google App Engine
This is Rietveld 408576698