blob: 9e15826a867e6443f6b11562bd71abaea2425b73 [file] [log] [blame]
// Copyright 2014 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.
#include <stddef.h>
#include "base/feature_list.h"
#include "base/time/time.h"
#include "components/sessions/core/session_id.h"
#include "url/gurl.h"
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 LoadingPredictorConfig;
// Returns true if prefetching is enabled, and initializes |config|, if not
// nullptr.
bool MaybeEnableResourcePrefetching(LoadingPredictorConfig* config);
// Represents the type of key based on which prefetch data is stored.
enum PrefetchKeyType {
// Represents a single navigation for a render frame.
struct 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;
} // namespace predictors