#include "third_party/blink/renderer/core/timing/soft_navigation_heuristics.h"
#include <utility>
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing_detector.h"
#include "third_party/blink/renderer/core/timing/dom_window_performance.h"
#include "third_party/blink/renderer/core/timing/soft_navigation_context.h"
#include "third_party/blink/renderer/platform/scheduler/public/task_attribution_info.h"
#include "third_party/blink/renderer/platform/scheduler/public/task_attribution_tracker.h"
namespace blink {
namespace {
const size_t SOFT_NAVIGATION_PAINT_AREA_PRECENTAGE = …;
const size_t HUNDRED_PERCENT = …;
const char kPageLoadInternalSoftNavigationOutcome[] = …;
enum SoftNavigationOutcome { … };
void LogAndTraceDetectedSoftNavigation(LocalFrame* frame,
LocalDOMWindow* window,
const SoftNavigationContext& context) { … }
constexpr bool IsInteractionStart(
SoftNavigationHeuristics::EventScope::Type type) { … }
constexpr bool IsInteractionEnd(
SoftNavigationHeuristics::EventScope::Type type) { … }
std::optional<SoftNavigationHeuristics::EventScope::Type>
EventScopeTypeFromEvent(const Event& event) { … }
}
const char SoftNavigationHeuristics::kSupplementName[] = …;
SoftNavigationHeuristics::SoftNavigationHeuristics(LocalDOMWindow& window)
: … { … }
SoftNavigationHeuristics* SoftNavigationHeuristics::From(
LocalDOMWindow& window) { … }
void SoftNavigationHeuristics::Dispose() { … }
void SoftNavigationHeuristics::RecordUmaForNonSoftNavigationInteraction(
const SoftNavigationContext& context) const { … }
void SoftNavigationHeuristics::SetIsTrackingSoftNavigationHeuristicsOnDocument(
bool value) const { … }
void SoftNavigationHeuristics::ResetHeuristic() { … }
SoftNavigationContext*
SoftNavigationHeuristics::GetSoftNavigationContextForCurrentTask() { … }
std::optional<scheduler::TaskAttributionId>
SoftNavigationHeuristics::AsyncSameDocumentNavigationStarted() { … }
void SoftNavigationHeuristics::SameDocumentNavigationCommitted(
const String& url,
SoftNavigationContext* context) { … }
bool SoftNavigationHeuristics::ModifiedDOM() { … }
void SoftNavigationHeuristics::EmitSoftNavigationEntryIfAllConditionsMet(
SoftNavigationContext* context) { … }
void SoftNavigationHeuristics::RecordPaint(
LocalFrame* frame,
uint64_t painted_area,
bool is_modified_by_soft_navigation) { … }
void SoftNavigationHeuristics::ReportSoftNavigationToMetrics(
LocalFrame* frame,
SoftNavigationContext* context) const { … }
void SoftNavigationHeuristics::ResetPaintsIfNeeded() { … }
void SoftNavigationHeuristics::CommitPreviousPaints(LocalFrame* frame) { … }
void SoftNavigationHeuristics::Trace(Visitor* visitor) const { … }
void SoftNavigationHeuristics::OnCreateTaskScope(
scheduler::TaskAttributionInfo& task_state) { … }
void SoftNavigationHeuristics::ProcessCustomWeakness(
const LivenessBroker& info) { … }
LocalFrame* SoftNavigationHeuristics::GetLocalFrameIfNotDetached() const { … }
SoftNavigationHeuristics::EventScope SoftNavigationHeuristics::CreateEventScope(
EventScope::Type type,
ScriptState* script_state) { … }
std::optional<SoftNavigationHeuristics::EventScope>
SoftNavigationHeuristics::MaybeCreateEventScopeForEvent(const Event& event) { … }
void SoftNavigationHeuristics::OnSoftNavigationEventScopeDestroyed(
const EventScope& event_scope) { … }
SoftNavigationHeuristics::EventScope::EventScope(
SoftNavigationHeuristics* heuristics,
std::optional<ObserverScope> observer_scope,
std::optional<TaskScope> task_scope,
Type type,
bool is_nested)
: … { … }
SoftNavigationHeuristics::EventScope::EventScope(EventScope&& other)
: … { … }
SoftNavigationHeuristics::EventScope&
SoftNavigationHeuristics::EventScope::operator=(EventScope&& other) { … }
SoftNavigationHeuristics::EventScope::~EventScope() { … }
}