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

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

Issue 2762673002: predictors: Pass manifests from Bork to store in ResourcePrefetchPredictor. (Closed)
Patch Set: Add delegate tests for PrecacheFetcher. Created 3 years, 9 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 afd5e6c6e737de5006cfab24431c96ad684654da..3f678e9fcab99d7b4821fb42439692cc803dc2e9 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -55,6 +55,7 @@ namespace precache {
class PrecacheDatabase;
class PrecacheUnfinishedWork;
+class PrecacheManifest;
extern const char kPrecacheFieldTrialName[];
@@ -73,6 +74,13 @@ class PrecacheManager : public KeyedService,
public PrecacheFetcher::PrecacheDelegate,
public base::SupportsWeakPtr<PrecacheManager> {
public:
+ class Delegate {
+ public:
+ // Called when a precache manifest has been successfully fetched and parsed.
+ virtual void OnManifestFetched(const std::string& host,
+ const PrecacheManifest& manifest) = 0;
+ };
+
typedef base::Callback<void(bool)> PrecacheCompletionCallback;
PrecacheManager(content::BrowserContext* browser_context,
@@ -80,6 +88,7 @@ class PrecacheManager : public KeyedService,
const history::HistoryService* history_service,
const data_reduction_proxy::DataReductionProxySettings*
data_reduction_proxy_settings,
+ Delegate* delegate,
const base::FilePath& db_path,
std::unique_ptr<PrecacheDatabase> precache_database);
~PrecacheManager() override;
@@ -153,6 +162,8 @@ class PrecacheManager : public KeyedService,
// From PrecacheFetcher::PrecacheDelegate.
void OnDone() override;
+ void OnManifestFetched(const std::string& host,
+ const PrecacheManifest& manifest) override;
// Registers the precache synthetic field trial for users whom the precache
// task was run recently. |last_precache_time| is the last time precache task
@@ -219,6 +230,10 @@ class PrecacheManager : public KeyedService,
const data_reduction_proxy::DataReductionProxySettings* const
data_reduction_proxy_settings_;
+ // The Delegate corresponding to the browser context. Used to notify the
+ // browser about a new available manifest. May be null.
+ Delegate* delegate_;
+
// The PrecacheFetcher used to precache resources. Should only be used on the
// UI thread.
std::unique_ptr<PrecacheFetcher> precache_fetcher_;
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor_unittest.cc ('k') | components/precache/content/precache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698