chromium/cc/metrics/event_metrics.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "cc/metrics/event_metrics.h"

#include <algorithm>
#include <ostream>
#include <string>
#include <utility>

#include "base/check.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/time/default_tick_clock.h"
#include "cc/metrics/event_latency_tracing_recorder.h"

namespace cc {
namespace {

// Histogram bucketing for scroll event metrics.
constexpr base::TimeDelta kScrollHistogramMin =;
constexpr base::TimeDelta kScrollHistogramMax =;
constexpr size_t kScrollHistogramBucketCount =;

constexpr struct {} kInterestingEvents[] =;
static_assert;

constexpr struct {} kScrollTypes[] =;
static_assert;

constexpr struct {} kPinchTypes[] =;
static_assert;

std::optional<EventMetrics::EventType> ToInterestingEventType(
    ui::EventType ui_event_type,
    std::optional<bool> scroll_is_inertial,
    std::optional<ScrollUpdateEventMetrics::ScrollUpdateType>
        scroll_update_type) {}

ScrollEventMetrics::ScrollType ToScrollType(ui::ScrollInputType ui_input_type) {}

PinchEventMetrics::PinchType ToPinchType(ui::ScrollInputType ui_input_type) {}

bool IsGestureScroll(ui::EventType type) {}

bool IsGesturePinch(ui::EventType type) {}

bool IsGestureScrollUpdate(ui::EventType type) {}

}  // namespace

// EventMetrics:

// static
std::unique_ptr<EventMetrics> EventMetrics::Create(
    ui::EventType type,
    base::TimeTicks timestamp,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<EventMetrics> EventMetrics::Create(
    ui::EventType type,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<EventMetrics> EventMetrics::CreateForTesting(
    ui::EventType type,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<EventMetrics> EventMetrics::CreateFromExisting(
    ui::EventType type,
    DispatchStage last_dispatch_stage,
    const EventMetrics* existing) {}

// static
std::unique_ptr<EventMetrics> EventMetrics::CreateInternal(
    ui::EventType type,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id) {}

EventMetrics::EventMetrics(EventType type,
                           base::TimeTicks timestamp,
                           const base::TickClock* tick_clock,
                           std::optional<TraceId> trace_id)
    :{}

EventMetrics::EventMetrics(EventType type,
                           base::TimeTicks timestamp,
                           base::TimeTicks arrived_in_browser_main_timestamp,
                           const base::TickClock* tick_clock,
                           std::optional<TraceId> trace_id)
    :{}

EventMetrics::EventMetrics(const EventMetrics& other)
    :{}

EventMetrics::~EventMetrics() {}

const char* EventMetrics::GetTypeName() const {}

// static
const char* EventMetrics::GetTypeName(EventMetrics::EventType type) {}

const std::optional<EventMetrics::HistogramBucketing>&
EventMetrics::GetHistogramBucketing() const {}

void EventMetrics::SetHighLatencyStage(const std::string& stage) {}

void EventMetrics::SetDispatchStageTimestamp(DispatchStage stage) {}

void EventMetrics::SetDispatchStageTimestamp(DispatchStage stage,
                                             base::TimeTicks timestamp) {}

base::TimeTicks EventMetrics::GetDispatchStageTimestamp(
    DispatchStage stage) const {}

void EventMetrics::ResetToDispatchStage(DispatchStage stage) {}

bool EventMetrics::HasSmoothInputEvent() const {}

ScrollEventMetrics* EventMetrics::AsScroll() {}

const ScrollEventMetrics* EventMetrics::AsScroll() const {}

ScrollUpdateEventMetrics* EventMetrics::AsScrollUpdate() {}

const ScrollUpdateEventMetrics* EventMetrics::AsScrollUpdate() const {}

PinchEventMetrics* EventMetrics::AsPinch() {}

const PinchEventMetrics* EventMetrics::AsPinch() const {}

std::unique_ptr<EventMetrics> EventMetrics::Clone() const {}

void EventMetrics::CopyTimestampsFrom(const EventMetrics& other,
                                      DispatchStage last_dispatch_stage) {}

// ScrollEventMetrics

// static
std::unique_ptr<ScrollEventMetrics> ScrollEventMetrics::Create(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    base::TimeTicks blocking_touch_dispatched_to_renderer,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<ScrollEventMetrics> ScrollEventMetrics::CreateForBrowser(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    base::TimeTicks timestamp,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<ScrollEventMetrics> ScrollEventMetrics::CreateForTesting(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock) {}

// static
std::unique_ptr<ScrollEventMetrics> ScrollEventMetrics::CreateFromExisting(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    DispatchStage last_dispatch_stage,
    const EventMetrics* existing) {}

// static
std::unique_ptr<ScrollEventMetrics> ScrollEventMetrics::CreateInternal(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id) {}

ScrollEventMetrics::ScrollEventMetrics(
    EventType type,
    ScrollType scroll_type,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id)
    :{}

ScrollEventMetrics::ScrollEventMetrics(const ScrollEventMetrics&) = default;

ScrollEventMetrics::~ScrollEventMetrics() {}

const char* ScrollEventMetrics::GetScrollTypeName() const {}

ScrollEventMetrics* ScrollEventMetrics::AsScroll() {}

std::unique_ptr<EventMetrics> ScrollEventMetrics::Clone() const {}

// ScrollUpdateEventMetrics

// static
std::unique_ptr<ScrollUpdateEventMetrics> ScrollUpdateEventMetrics::Create(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    ScrollUpdateType scroll_update_type,
    float delta,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    base::TimeTicks blocking_touch_dispatched_to_renderer,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<ScrollUpdateEventMetrics>
ScrollUpdateEventMetrics::CreateForBrowser(ui::EventType type,
                                           ui::ScrollInputType input_type,
                                           bool is_inertial,
                                           ScrollUpdateType scroll_update_type,
                                           float delta,
                                           base::TimeTicks timestamp,
                                           TraceId trace_id) {}

// static
std::unique_ptr<ScrollUpdateEventMetrics>
ScrollUpdateEventMetrics::CreateForTesting(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    ScrollUpdateType scroll_update_type,
    float delta,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id) {}

// static
std::unique_ptr<ScrollUpdateEventMetrics>
ScrollUpdateEventMetrics::CreateFromExisting(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    ScrollUpdateType scroll_update_type,
    float delta,
    DispatchStage last_dispatch_stage,
    const EventMetrics* existing) {}

// static
std::unique_ptr<ScrollUpdateEventMetrics>
ScrollUpdateEventMetrics::CreateInternal(
    ui::EventType type,
    ui::ScrollInputType input_type,
    bool is_inertial,
    ScrollUpdateType scroll_update_type,
    float delta,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id) {}

ScrollUpdateEventMetrics::ScrollUpdateEventMetrics(
    EventType type,
    ScrollType scroll_type,
    ScrollUpdateType scroll_update_type,
    float delta,
    base::TimeTicks timestamp,
    base::TimeTicks arrived_in_browser_main_timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id)
    :{}

ScrollUpdateEventMetrics::ScrollUpdateEventMetrics(
    const ScrollUpdateEventMetrics&) = default;

ScrollUpdateEventMetrics::~ScrollUpdateEventMetrics() {}

void ScrollUpdateEventMetrics::CoalesceWith(
    const ScrollUpdateEventMetrics& newer_scroll_update) {}

ScrollUpdateEventMetrics* ScrollUpdateEventMetrics::AsScrollUpdate() {}

std::unique_ptr<EventMetrics> ScrollUpdateEventMetrics::Clone() const {}

// PinchEventMetrics

// static
std::unique_ptr<PinchEventMetrics> PinchEventMetrics::Create(
    ui::EventType type,
    ui::ScrollInputType input_type,
    base::TimeTicks timestamp,
    TraceId trace_id) {}

// static
std::unique_ptr<PinchEventMetrics> PinchEventMetrics::CreateForTesting(
    ui::EventType type,
    ui::ScrollInputType input_type,
    base::TimeTicks timestamp,
    const base::TickClock* tick_clock) {}

// static
std::unique_ptr<PinchEventMetrics> PinchEventMetrics::CreateInternal(
    ui::EventType type,
    ui::ScrollInputType input_type,
    base::TimeTicks timestamp,
    const base::TickClock* tick_clock,
    std::optional<TraceId> trace_id) {}

PinchEventMetrics::PinchEventMetrics(EventType type,
                                     PinchType pinch_type,
                                     base::TimeTicks timestamp,
                                     const base::TickClock* tick_clock,
                                     std::optional<TraceId> trace_id)
    :{}

PinchEventMetrics::PinchEventMetrics(const PinchEventMetrics&) = default;

PinchEventMetrics::~PinchEventMetrics() {}

const char* PinchEventMetrics::GetPinchTypeName() const {}

PinchEventMetrics* PinchEventMetrics::AsPinch() {}

std::unique_ptr<EventMetrics> PinchEventMetrics::Clone() const {}

// EventMetricsSet
EventMetricsSet::EventMetricsSet() = default;
EventMetricsSet::~EventMetricsSet() = default;
EventMetricsSet::EventMetricsSet(EventMetrics::List main_thread_event_metrics,
                                 EventMetrics::List impl_thread_event_metrics)
    :{}
EventMetricsSet::EventMetricsSet(EventMetricsSet&& other) = default;
EventMetricsSet& EventMetricsSet::operator=(EventMetricsSet&& other) = default;

}  // namespace cc