Chromium Code Reviews| Index: chrome/browser/predictors/glowplug_config.h |
| diff --git a/chrome/browser/predictors/resource_prefetch_common.h b/chrome/browser/predictors/glowplug_config.h |
| similarity index 53% |
| copy from chrome/browser/predictors/resource_prefetch_common.h |
| copy to chrome/browser/predictors/glowplug_config.h |
| index c4303271a43cbb4084bb740c0b521a388ec9436d..8e8928475e40dc89966220f3ab052b7201736378 100644 |
| --- a/chrome/browser/predictors/resource_prefetch_common.h |
| +++ b/chrome/browser/predictors/glowplug_config.h |
| @@ -1,82 +1,30 @@ |
| -// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// 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_RESOURCE_PREFETCH_COMMON_H_ |
| -#define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| +#ifndef CHROME_BROWSER_PREDICTORS_GLOWPLUG_CONFIG_H_ |
| +#define CHROME_BROWSER_PREDICTORS_GLOWPLUG_CONFIG_H_ |
| -#include <stddef.h> |
| - |
| -#include "base/feature_list.h" |
| -#include "base/time/time.h" |
| -#include "components/sessions/core/session_id.h" |
| -#include "url/gurl.h" |
| +#include <cstddef> |
| class Profile; |
| -namespace content { |
| -class WebContents; |
| -} |
| - |
| namespace predictors { |
| -extern const char kSpeculativeResourcePrefetchingFeatureName[]; |
| -extern const char kModeParamName[]; |
| -extern const char kLearningMode[]; |
| -extern const char kExternalPrefetchingMode[]; |
| -extern const char kPrefetchingMode[]; |
| -extern const char kEnableUrlLearningParamName[]; |
| -extern const char kEnableManifestsParamName[]; |
| -extern const char kEnableOriginLearningParamName[]; |
| -extern const base::Feature kSpeculativeResourcePrefetchingFeature; |
| - |
| -struct ResourcePrefetchPredictorConfig; |
| - |
| -// Returns true if prefetching is enabled. And will initilize the |config| |
| -// fields to the appropritate values. |
| -bool IsSpeculativeResourcePrefetchingEnabled( |
| - Profile* profile, |
| - ResourcePrefetchPredictorConfig* config); |
| - |
| -// Represents the type of key based on which prefetch data is stored. |
| -enum PrefetchKeyType { |
| - PREFETCH_KEY_TYPE_HOST, |
| - PREFETCH_KEY_TYPE_URL |
| -}; |
| +struct GlowplugPredictorConfig; |
| + |
| +// Returns whether glowplug is enabled, and populate |config|, if not nullptr. |
| +bool IsGlowplugEnabled(Profile* profile, GlowplugPredictorConfig* config); |
| // Indicates what caused the prefetch request. |
| enum class PrefetchOrigin { NAVIGATION, EXTERNAL }; |
| -// Represents a single navigation for a render frame. |
| -struct NavigationID { |
| - NavigationID(); |
| - explicit NavigationID(content::WebContents* web_contents); |
| - NavigationID(content::WebContents* web_contents, |
| - const GURL& main_frame_url, |
| - const base::TimeTicks& creation_time); |
| - NavigationID(const NavigationID& other); |
| - |
| - bool operator<(const NavigationID& rhs) const; |
| - bool operator==(const NavigationID& rhs) const; |
| - |
| - // Returns true iff the tab_id is valid and the Main frame URL is set. |
| - bool is_valid() const; |
| - |
| - SessionID::id_type tab_id; |
| - GURL main_frame_url; |
| - |
| - // NOTE: Even though we store the creation time here, it is not used during |
| - // comparison of two NavigationIDs because it cannot always be determined |
| - // correctly. |
| - base::TimeTicks creation_time; |
| -}; |
| - |
| -// Represents the config for the resource prefetch prediction algorithm. |
| -struct ResourcePrefetchPredictorConfig { |
| +// Represents the config for the Glowplug predictor. |
| +struct GlowplugPredictorConfig { |
|
alexilin
2017/05/11 16:53:12
I don't see clear benefits of moving it outside of
Benoit L
2017/05/12 12:12:52
The goal is to have a global object to configure g
alexilin
2017/05/12 14:26:45
Cool, makes sense. Thanks!
|
| // Initializes the config with default values. |
| - ResourcePrefetchPredictorConfig(); |
| - ResourcePrefetchPredictorConfig(const ResourcePrefetchPredictorConfig& other); |
| - ~ResourcePrefetchPredictorConfig(); |
| + GlowplugPredictorConfig(); |
| + GlowplugPredictorConfig(const GlowplugPredictorConfig& other); |
| + ~GlowplugPredictorConfig(); |
| // The mode the prefetcher is running in. Forms a bit map. |
| enum Mode { |
| @@ -142,4 +90,4 @@ struct ResourcePrefetchPredictorConfig { |
| } // namespace predictors |
| -#endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_COMMON_H_ |
| +#endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_CONFIG_H_ |