Chromium Code Reviews| 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 // All methods must be called from the UI thread. | |
|
alexilin
2017/05/11 16:53:12
Shouldn't we have here a detailed description of t
Benoit L
2017/05/12 12:12:52
Done.
| |
| 22 class GlowplugPredictor : public KeyedService, | |
| 23 public base::SupportsWeakPtr<GlowplugPredictor> { | |
| 24 public: | |
| 25 GlowplugPredictor(const GlowplugPredictorConfig& config, Profile* profile); | |
| 26 ~GlowplugPredictor() override; | |
| 27 | |
| 28 // Starts prefetching if it is enabled for |origin| and prefetching data | |
| 29 // exists for the |main_frame_url| either at the URL or at the host level. | |
| 30 void StartPrefetching(const GURL& main_frame_url, PrefetchOrigin origin); | |
|
alexilin
2017/05/11 16:53:12
Do you want to keep this function name? I think no
Benoit L
2017/05/12 12:12:52
Done.
| |
| 31 // Stops prefetching that may be in progress corresponding to | |
| 32 // |main_frame_url|. | |
| 33 void StopPrefetching(const GURL& main_frame_url); | |
| 34 | |
| 35 ResourcePrefetchPredictor* resource_prefetch_predictor() const; | |
|
alexilin
2017/05/11 16:53:12
As I understand, it's temporary for clients who wi
Benoit L
2017/05/12 12:12:52
Yes, it's temporary. Added a comment.
Getting a ra
alexilin
2017/05/12 14:26:45
Clients could outlive GlowplugPredictor while keep
Benoit L
2017/05/12 15:13:11
Per offline discussion, no issues here, since the
| |
| 36 | |
| 37 // KeyedService methods override. | |
| 38 void Shutdown() override; | |
| 39 | |
| 40 private: | |
| 41 std::unique_ptr<ResourcePrefetchPredictor> resource_prefetch_predictor_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(GlowplugPredictor); | |
| 44 }; | |
| 45 | |
| 46 } // namespace predictors | |
| 47 | |
| 48 #endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ | |
| OLD | NEW |