#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/loader/interactive_detector.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/profiler/sample_metadata.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
namespace blink {
namespace {
int g_num_long_input_events = …;
constexpr base::TimeDelta kInputDelayTraceEventThreshold = …;
constexpr base::TimeDelta kFirstInputDelayTraceEventThreshold = …;
}
constexpr auto kTimeToInteractiveWindow = …;
constexpr int kNetworkQuietMaximumConnections = …;
const char kHistogramInputDelay[] = …;
const char kHistogramInputTimestamp[] = …;
const char kHistogramProcessingTime[] = …;
const char kHistogramTimeToNextPaint[] = …;
const char InteractiveDetector::kSupplementName[] = …;
InteractiveDetector* InteractiveDetector::From(Document& document) { … }
const char* InteractiveDetector::SupplementName() { … }
InteractiveDetector::InteractiveDetector(
Document& document,
std::unique_ptr<NetworkActivityChecker> network_activity_checker)
: … { … }
void InteractiveDetector::SetNavigationStartTime(
base::TimeTicks navigation_start_time) { … }
int InteractiveDetector::NetworkActivityChecker::GetActiveConnections() { … }
int InteractiveDetector::ActiveConnections() { … }
void InteractiveDetector::StartOrPostponeCITimer(
base::TimeTicks timer_fire_time) { … }
std::optional<base::TimeDelta> InteractiveDetector::GetFirstInputDelay() const { … }
WTF::Vector<std::optional<base::TimeDelta>>
InteractiveDetector::GetFirstInputDelaysAfterBackForwardCacheRestore() const { … }
std::optional<base::TimeTicks> InteractiveDetector::GetFirstInputTimestamp()
const { … }
std::optional<base::TimeTicks> InteractiveDetector::GetFirstScrollTimestamp()
const { … }
std::optional<base::TimeDelta> InteractiveDetector::GetFirstScrollDelay()
const { … }
bool InteractiveDetector::PageWasBackgroundedSinceEvent(
base::TimeTicks event_time) { … }
void InteractiveDetector::HandleForInputDelay(
const Event& event,
base::TimeTicks event_platform_timestamp,
base::TimeTicks processing_start) { … }
void InteractiveDetector::BeginNetworkQuietPeriod(
base::TimeTicks current_time) { … }
void InteractiveDetector::EndNetworkQuietPeriod(base::TimeTicks current_time) { … }
void InteractiveDetector::UpdateNetworkQuietState(
double request_count,
std::optional<base::TimeTicks> opt_current_time) { … }
void InteractiveDetector::OnResourceLoadBegin(
std::optional<base::TimeTicks> load_begin_time) { … }
void InteractiveDetector::OnResourceLoadEnd(
std::optional<base::TimeTicks> load_finish_time) { … }
void InteractiveDetector::OnLongTaskDetected(base::TimeTicks start_time,
base::TimeTicks end_time) { … }
void InteractiveDetector::OnFirstContentfulPaint(
base::TimeTicks first_contentful_paint) { … }
void InteractiveDetector::OnDomContentLoadedEnd(base::TimeTicks dcl_end_time) { … }
void InteractiveDetector::OnInvalidatingInputEvent(
base::TimeTicks invalidation_time) { … }
void InteractiveDetector::OnPageHiddenChanged(bool is_hidden) { … }
void InteractiveDetector::TimeToInteractiveTimerFired(TimerBase*) { … }
void InteractiveDetector::AddCurrentlyActiveNetworkQuietInterval(
base::TimeTicks current_time) { … }
void InteractiveDetector::RemoveCurrentlyActiveNetworkQuietInterval() { … }
base::TimeTicks InteractiveDetector::FindInteractiveCandidate(
base::TimeTicks lower_bound,
base::TimeTicks current_time) { … }
void InteractiveDetector::CheckTimeToInteractiveReached() { … }
void InteractiveDetector::OnTimeToInteractiveDetected() { … }
base::TimeDelta InteractiveDetector::ComputeTotalBlockingTime() { … }
void InteractiveDetector::ContextDestroyed() { … }
void InteractiveDetector::Trace(Visitor* visitor) const { … }
void InteractiveDetector::SetTickClockForTesting(const base::TickClock* clock) { … }
void InteractiveDetector::SetTaskRunnerForTesting(
scoped_refptr<base::SingleThreadTaskRunner> task_runner_for_testing) { … }
void InteractiveDetector::RecordInputEventTimingUMA(
base::TimeDelta processing_time,
base::TimeDelta time_to_next_paint) { … }
void InteractiveDetector::DidObserveFirstScrollDelay(
base::TimeDelta first_scroll_delay,
base::TimeTicks first_scroll_timestamp) { … }
void InteractiveDetector::OnRestoredFromBackForwardCache() { … }
}