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

Unified Diff: chrome/browser/predictors/loading_predictor.h

Issue 2847183002: predictors: Introduce GlowplugPredictor. (Closed)
Patch Set: GlowplugPredictor -> LoadingPredictor Created 3 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 | « chrome/browser/precache/precache_manager_factory.cc ('k') | chrome/browser/predictors/loading_predictor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/predictors/loading_predictor.h
diff --git a/chrome/browser/predictors/loading_predictor.h b/chrome/browser/predictors/loading_predictor.h
new file mode 100644
index 0000000000000000000000000000000000000000..37be5af0bf418cf5a71f034bf94c96f58e41ec2e
--- /dev/null
+++ b/chrome/browser/predictors/loading_predictor.h
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PREDICTORS_LOADING_PREDICTOR_H_
+#define CHROME_BROWSER_PREDICTORS_LOADING_PREDICTOR_H_
+
+#include <memory>
+
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/predictors/resource_prefetch_common.h"
+#include "chrome/browser/predictors/resource_prefetch_predictor.h"
+#include "components/keyed_service/core/keyed_service.h"
+
+class Profile;
+
+namespace predictors {
+
+class ResourcePrefetchPredictor;
+
+// Entry point for the Loading predictor.
+// From a high-level request (GURL and motivation) and a database of historical
+// data, initiates predictive actions to speed up page loads.
+//
+// See ResourcePrefetchPredictor for a description of the resource prefetch
+// predictor.
+//
+// All methods must be called from the UI thread.
+class LoadingPredictor : public KeyedService,
+ public base::SupportsWeakPtr<LoadingPredictor> {
+ public:
+ LoadingPredictor(const LoadingPredictorConfig& config, Profile* profile);
+ ~LoadingPredictor() override;
+
+ // Hints that a page load is expected for |url|, with the hint coming from a
+ // given |origin|. May trigger actions, such as prefetch and/or preconnect.
+ void PrepareForPageLoad(const GURL& url, HintOrigin origin);
+
+ // Indicates that a page load hint is no longer active.
+ void CancelPageLoadHint(const GURL& url);
+
+ // Don't use, internal only.
+ ResourcePrefetchPredictor* resource_prefetch_predictor() const;
+
+ // KeyedService:
+ void Shutdown() override;
+
+ private:
+ std::unique_ptr<ResourcePrefetchPredictor> resource_prefetch_predictor_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoadingPredictor);
+};
+
+} // namespace predictors
+
+#endif // CHROME_BROWSER_PREDICTORS_LOADING_PREDICTOR_H_
« no previous file with comments | « chrome/browser/precache/precache_manager_factory.cc ('k') | chrome/browser/predictors/loading_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698