chromium/third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc

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

#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[] =;

// These values are logged to UMA. Entries should not be renumbered and numeric
// values should never be reused. Please keep in sync with
// "SoftNavigationOutcome" in tools/metrics/histograms/enums.xml. Note also that
// these form a bitmask; future conditions should continue this pattern.
// LINT.IfChange
enum SoftNavigationOutcome {};
// LINT.ThenChange(/tools/metrics/histograms/enums.xml: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) {}

}  // namespace

// static
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) {}

// This is called from Text/ImagePaintTimingDetector when a paint is recorded
// there.
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() {}

// Once all the soft navigation conditions are met (verified in
// `EmitSoftNavigationEntryIfAllConditionsMet()`), the previous paints are
// committed, to make sure accumulated FP, FCP and LCP entries are properly
// fired.
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 implementation
// ///////////////////////////////////////////
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() {}

}  // namespace blink