Chromium Code Reviews| Index: chrome/browser/predictors/glowplug_predictor.h |
| diff --git a/chrome/browser/predictors/glowplug_predictor.h b/chrome/browser/predictors/glowplug_predictor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..94ec42d762aeeb2f8dd301420693836fc3b12cde |
| --- /dev/null |
| +++ b/chrome/browser/predictors/glowplug_predictor.h |
| @@ -0,0 +1,48 @@ |
| +// 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_GLOWPLUG_PREDICTOR_H_ |
| +#define CHROME_BROWSER_PREDICTORS_GLOWPLUG_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; |
| + |
| +// 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.
|
| +class GlowplugPredictor : public KeyedService, |
| + public base::SupportsWeakPtr<GlowplugPredictor> { |
| + public: |
| + GlowplugPredictor(const GlowplugPredictorConfig& config, Profile* profile); |
| + ~GlowplugPredictor() override; |
| + |
| + // Starts prefetching if it is enabled for |origin| and prefetching data |
| + // exists for the |main_frame_url| either at the URL or at the host level. |
| + 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.
|
| + // Stops prefetching that may be in progress corresponding to |
| + // |main_frame_url|. |
| + void StopPrefetching(const GURL& main_frame_url); |
| + |
| + 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
|
| + |
| + // KeyedService methods override. |
| + void Shutdown() override; |
| + |
| + private: |
| + std::unique_ptr<ResourcePrefetchPredictor> resource_prefetch_predictor_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(GlowplugPredictor); |
| +}; |
| + |
| +} // namespace predictors |
| + |
| +#endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_PREDICTOR_H_ |