chromium/content/browser/preloading/preloading_config.cc

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

#include "content/browser/preloading/preloading_config.h"

#include <string_view>

#include "base/json/json_reader.h"
#include "base/metrics/field_trial_params.h"
#include "base/values.h"
#include "content/browser/preloading/preloading.h"
#include "content/common/features.h"
#include "content/public/browser/preloading.h"

namespace content {

namespace {

// Allows configuring preloading features via a JSON string. This string should
// contain a JSON array of objects. Each object should specify a preloading_type
// key (a string to specify which preloading type is being configured) and a
// predictor key (a string to specify which predictor is being configured). Then
// each object can specify some parameters to tune. Supported parameters are:
//  * holdback: whether this preloading_type, predictor combination should be
//    held back for counterfactual evaluation.
//  * sampling_likelihood: the fraction of preloading attempts that will be
//    logged in UKM. See crbug.com/1411841#c3 to see how the sampling_likelihood
//    default values are determined.
constexpr base::FeatureParam<std::string> kPreloadingConfigParam{};

static PreloadingConfig* g_config_override =;

}  // namespace

PreloadingConfig& PreloadingConfig::GetInstance() {}

PreloadingConfig::PreloadingConfig() = default;

PreloadingConfig* PreloadingConfig::OverrideForTesting(
    PreloadingConfig* config_override) {}

void PreloadingConfig::ParseConfig() {}

PreloadingConfig::~PreloadingConfig() = default;

bool PreloadingConfig::ShouldHoldback(PreloadingType preloading_type,
                                      PreloadingPredictor predictor) {}

void PreloadingConfig::SetHoldbackForTesting(PreloadingType preloading_type,
                                             PreloadingPredictor predictor,
                                             bool holdback) {}

void PreloadingConfig::SetHoldbackForTesting(std::string_view preloading_type,
                                             std::string_view predictor,
                                             bool holdback) {}

double PreloadingConfig::SamplingLikelihood(PreloadingType preloading_type,
                                            PreloadingPredictor predictor) {}

PreloadingConfig::Key::Key(std::string_view preloading_type,
                           std::string_view predictor)
    :{}

PreloadingConfig::Key PreloadingConfig::Key::FromEnums(
    PreloadingType preloading_type,
    PreloadingPredictor predictor) {}

PreloadingConfig::Entry PreloadingConfig::Entry::FromDict(
    const base::Value::Dict* dict) {}

bool PreloadingConfig::KeyCompare::operator()(
    const PreloadingConfig::Key& lhs,
    const PreloadingConfig::Key& rhs) const {}

}  // namespace content