#include "content/browser/preloading/preloading_attempt_impl.h"
#include "base/containers/span.h"
#include "base/metrics/crc32.h"
#include "base/metrics/histogram_functions.h"
#include "base/state_transitions.h"
#include "base/strings/strcat.h"
#include "content/browser/preloading/preloading.h"
#include "content/browser/preloading/preloading_config.h"
#include "content/public/browser/preloading.h"
#include "services/metrics/public/cpp/metrics_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/common/features.h"
namespace content {
namespace {
void DCHECKTriggeringOutcomeTransitions(PreloadingTriggeringOutcome old_state,
PreloadingTriggeringOutcome new_state) { … }
bool IsPreloadingTypeUpgradableTo(PreloadingType lhs, PreloadingType rhs) { … }
}
void PreloadingAttemptImpl::SetEligibility(PreloadingEligibility eligibility) { … }
void PreloadingAttemptImpl::SetHoldbackStatus(
PreloadingHoldbackStatus holdback_status) { … }
bool PreloadingAttemptImpl::ShouldHoldback() { … }
void PreloadingAttemptImpl::SetTriggeringOutcome(
PreloadingTriggeringOutcome triggering_outcome) { … }
void PreloadingAttemptImpl::SetFailureReason(PreloadingFailureReason reason) { … }
base::WeakPtr<PreloadingAttempt> PreloadingAttemptImpl::GetWeakPtr() { … }
PreloadingAttemptImpl::PreloadingAttemptImpl(
const PreloadingPredictor& creating_predictor,
const PreloadingPredictor& enacting_predictor,
PreloadingType preloading_type,
ukm::SourceId triggered_primary_page_source_id,
PreloadingURLMatchCallback url_match_predicate,
std::optional<PreloadingType> planned_max_preloading_type,
uint32_t sampling_seed)
: … { … }
PreloadingAttemptImpl::~PreloadingAttemptImpl() = default;
std::vector<PreloadingPredictor> PreloadingAttemptImpl::GetPredictors() const { … }
void PreloadingAttemptImpl::RecordPreloadingAttemptMetrics(
ukm::SourceId navigated_page_source_id) { … }
void PreloadingAttemptImpl::RecordPreloadingAttemptUMA() { … }
void PreloadingAttemptImpl::SetNoVarySearchMatchPredicate(
PreloadingURLMatchCallback no_vary_search_match_predicate) { … }
void PreloadingAttemptImpl::SetIsAccurateTriggering(const GURL& navigated_url) { … }
void PreloadingAttemptImpl::SetSpeculationEagerness(
blink::mojom::SpeculationEagerness eagerness) { … }
void PreloadingAttemptImpl::SetServiceWorkerRegisteredCheck(
ServiceWorkerRegisteredCheck check) { … }
void PreloadingAttemptImpl::SetServiceWorkerRegisteredCheckDuration(
base::TimeDelta duration) { … }
std::ostream& operator<<(std::ostream& os,
const PreloadingTriggeringOutcome& outcome) { … }
}