#include "third_party/blink/renderer/core/inspector/inspector_preload_agent.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/dom/dom_node_ids.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/html/html_anchor_element.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/inspector/inspected_frames.h"
#include "third_party/blink/renderer/core/inspector/inspector_base_agent.h"
#include "third_party/blink/renderer/core/inspector/protocol/preload.h"
#include "third_party/blink/renderer/core/speculation_rules/document_speculation_rules.h"
#include "third_party/blink/renderer/core/speculation_rules/speculation_candidate.h"
#include "third_party/blink/renderer/core/speculation_rules/speculation_rule_set.h"
namespace blink {
namespace {
std::optional<protocol::Preload::RuleSetErrorType> GetProtocolRuleSetErrorType(
SpeculationRuleSetErrorType error_type) { … }
String GetProtocolRuleSetErrorMessage(const SpeculationRuleSet& rule_set) { … }
struct PreloadingAttemptKey { … };
bool operator==(const PreloadingAttemptKey& a, const PreloadingAttemptKey& b) { … }
struct PreloadingAttemptKeyHashTraits
: WTF::GenericHashTraits<PreloadingAttemptKey> { … };
protocol::Preload::SpeculationAction GetProtocolSpeculationAction(
mojom::blink::SpeculationAction action) { … }
std::optional<protocol::Preload::SpeculationTargetHint>
GetProtocolSpeculationTargetHint(
mojom::blink::SpeculationTargetHint target_hint) { … }
std::unique_ptr<protocol::Preload::PreloadingAttemptKey>
BuildProtocolPreloadingAttemptKey(const PreloadingAttemptKey& key,
const Document& document) { … }
std::unique_ptr<protocol::Preload::PreloadingAttemptSource>
BuildProtocolPreloadingAttemptSource(
const PreloadingAttemptKey& key,
const HeapVector<Member<SpeculationCandidate>>& candidates,
Document& document) { … }
}
namespace internal {
std::unique_ptr<protocol::Preload::RuleSet> BuildProtocolRuleSet(
const SpeculationRuleSet& rule_set,
const String& loader_id) { … }
}
InspectorPreloadAgent::InspectorPreloadAgent(InspectedFrames* inspected_frames)
: … { … }
InspectorPreloadAgent::~InspectorPreloadAgent() = default;
void InspectorPreloadAgent::Restore() { … }
void InspectorPreloadAgent::DidAddSpeculationRuleSet(
Document& document,
const SpeculationRuleSet& rule_set) { … }
void InspectorPreloadAgent::DidRemoveSpeculationRuleSet(
const SpeculationRuleSet& rule_set) { … }
void InspectorPreloadAgent::SpeculationCandidatesUpdated(
Document& document,
const HeapVector<Member<SpeculationCandidate>>& candidates) { … }
void InspectorPreloadAgent::Trace(Visitor* visitor) const { … }
protocol::Response InspectorPreloadAgent::enable() { … }
protocol::Response InspectorPreloadAgent::disable() { … }
void InspectorPreloadAgent::EnableInternal() { … }
void InspectorPreloadAgent::ReportRuleSetsAndSources() { … }
}