chromium/chrome/browser/predictors/resource_prefetch_predictor.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/predictors/resource_prefetch_predictor.h"

#include <map>
#include <set>
#include <utility>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/predictors/lcp_critical_path_predictor/lcp_critical_path_predictor_util.h"
#include "chrome/browser/predictors/loading_data_collector.h"
#include "chrome/browser/predictors/predictor_database.h"
#include "chrome/browser/predictors/predictor_database_factory.h"
#include "chrome/browser/predictors/predictors_features.h"
#include "chrome/browser/profiles/profile.h"
#include "components/history/core/browser/history_database.h"
#include "components/history/core/browser/url_utils.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "net/base/url_util.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "third_party/blink/public/common/features.h"
#include "url/origin.h"

BrowserThread;

namespace predictors {

namespace {

const float kMinOriginConfidenceToTriggerPreconnect =;
const float kMinOriginConfidenceToTriggerPreresolve =;

float ComputeRedirectConfidence(const predictors::RedirectStat& redirect) {}

void InitializeOriginStatFromOriginRequestSummary(
    OriginStat* origin,
    const OriginRequestSummary& summary) {}

void InitializeOnDBSequence(
    ResourcePrefetchPredictor::RedirectDataMap* host_redirect_data,
    ResourcePrefetchPredictor::OriginDataMap* origin_data,
    LcppDataMap* lcpp_data) {}

GURL CreateRedirectURL(const std::string& scheme,
                       const std::string& host,
                       std::uint16_t port) {}

}  // namespace

PreconnectRequest::PreconnectRequest(
    const url::Origin& origin,
    int num_sockets,
    const net::NetworkAnonymizationKey& network_anonymization_key)
    :{}

PrefetchRequest::PrefetchRequest(
    const GURL& url,
    const net::NetworkAnonymizationKey& network_anonymization_key,
    network::mojom::RequestDestination destination)
    :{}

PreconnectPrediction::PreconnectPrediction() = default;
PreconnectPrediction::PreconnectPrediction(
    const PreconnectPrediction& prediction) = default;
PreconnectPrediction::PreconnectPrediction(PreconnectPrediction&& other) =
    default;
PreconnectPrediction::~PreconnectPrediction() = default;

PreconnectPrediction& PreconnectPrediction::operator=(
    const PreconnectPrediction& other) = default;
PreconnectPrediction& PreconnectPrediction::operator=(
    PreconnectPrediction&& other) = default;

OptimizationGuidePrediction::OptimizationGuidePrediction() = default;
OptimizationGuidePrediction::OptimizationGuidePrediction(
    const OptimizationGuidePrediction& prediction) = default;
OptimizationGuidePrediction::~OptimizationGuidePrediction() = default;

////////////////////////////////////////////////////////////////////////////////
// ResourcePrefetchPredictor static functions.

bool ResourcePrefetchPredictor::GetRedirectOrigin(
    const url::Origin& entry_origin,
    const RedirectDataMap& redirect_data,
    url::Origin* redirect_origin) {}

bool ResourcePrefetchPredictor::GetRedirectEndpointsForPreconnect(
    const url::Origin& entry_origin,
    const RedirectDataMap& redirect_data,
    PreconnectPrediction* prediction) const {}

////////////////////////////////////////////////////////////////////////////////
// ResourcePrefetchPredictor.

ResourcePrefetchPredictor::ResourcePrefetchPredictor(
    const LoadingPredictorConfig& config,
    Profile* profile)
    :{}

ResourcePrefetchPredictor::~ResourcePrefetchPredictor() {}

void ResourcePrefetchPredictor::StartInitialization() {}

bool ResourcePrefetchPredictor::IsUrlPreconnectable(
    const GURL& main_frame_url) const {}

void ResourcePrefetchPredictor::SetObserverForTesting(TestObserver* observer) {}

void ResourcePrefetchPredictor::Shutdown() {}

bool ResourcePrefetchPredictor::TryEnsureRecordingPrecondition() {}

void ResourcePrefetchPredictor::RecordPageRequestSummary(
    const PageRequestSummary& summary) {}

bool ResourcePrefetchPredictor::PredictPreconnectOrigins(
    const GURL& url,
    PreconnectPrediction* prediction) const {}

void ResourcePrefetchPredictor::CreateCaches(
    std::unique_ptr<RedirectDataMap> host_redirect_data,
    std::unique_ptr<OriginDataMap> origin_data,
    std::unique_ptr<LcppDataMap> lcpp_data) {}

void ResourcePrefetchPredictor::OnHistoryAndCacheLoaded() {}

void ResourcePrefetchPredictor::DeleteAllUrls() {}

void ResourcePrefetchPredictor::DeleteUrls(const history::URLRows& urls) {}

void ResourcePrefetchPredictor::LearnRedirect(const std::string& key,
                                              const GURL& final_redirect) {}

void ResourcePrefetchPredictor::LearnOrigins(
    const std::string& host,
    const GURL& main_frame_origin,
    const std::map<url::Origin, OriginRequestSummary>& summaries) {}

void ResourcePrefetchPredictor::LearnLcpp(
    const std::optional<url::Origin>& initiator_origin,
    const GURL& url,
    const LcppDataInputs& inputs) {}

std::optional<LcppStat> ResourcePrefetchPredictor::GetLcppStat(
    const std::optional<url::Origin>& initiator_origin,
    const GURL& url) const {}

void ResourcePrefetchPredictor::OnHistoryDeletions(
    history::HistoryService* history_service,
    const history::DeletionInfo& deletion_info) {}

void ResourcePrefetchPredictor::OnHistoryServiceLoaded(
    history::HistoryService* history_service) {}

void ResourcePrefetchPredictor::ConnectToHistoryService() {}

////////////////////////////////////////////////////////////////////////////////
// TestObserver.

TestObserver::~TestObserver() {}

TestObserver::TestObserver(ResourcePrefetchPredictor* predictor)
    :{}

}  // namespace predictors