OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ | |
6 #define CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "chrome/browser/predictors/resource_prefetch_common.h" | |
12 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | |
13 #include "components/keyed_service/core/keyed_service.h" | |
14 | |
15 class Profile; | |
16 | |
17 namespace predictors { | |
18 | |
19 class ResourcePrefetchPredictor; | |
20 | |
21 // Entry point for the Glowplug predictor. | |
22 // From a high-level request (GURL and motivation) and a database of historical | |
23 // data, initiates predictive actions to speed up page loads. | |
24 // | |
25 // See ResourcePrefetchPredictor for a description of the resource prefetch | |
26 // predictor. | |
27 // | |
28 // All methods must be called from the UI thread. | |
29 class GlowplugPredictor : public KeyedService, | |
30 public base::SupportsWeakPtr<GlowplugPredictor> { | |
31 public: | |
32 GlowplugPredictor(const GlowplugPredictorConfig& config, Profile* profile); | |
33 ~GlowplugPredictor() override; | |
34 | |
35 // Hints that a page load is expected for |url|, with the hint coming from a | |
36 // given |origin|. May trigger actions, such as prefetch and/or preconnect. | |
37 void PrepareForPageLoad(const GURL& url, HintOrigin origin); | |
38 | |
39 // Indicates that a page load hint is no longer active. | |
40 void CancelPageLoadHint(const GURL& url); | |
41 | |
42 // Don't use, internal only. | |
43 ResourcePrefetchPredictor* resource_prefetch_predictor() const; | |
44 | |
45 // KeyedService methods override. | |
alexilin
2017/05/12 14:26:45
silly nit:
/KeyedService methods override./KeyedSe
Benoit L
2017/05/12 15:13:11
Done.
| |
46 void Shutdown() override; | |
47 | |
48 private: | |
49 std::unique_ptr<ResourcePrefetchPredictor> resource_prefetch_predictor_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(GlowplugPredictor); | |
52 }; | |
53 | |
54 } // namespace predictors | |
55 | |
56 #endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ | |
OLD | NEW |