/* * Copyright (c) 2023, Luke Wilde * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include #include #include #include namespace Web::UserTiming { PerformanceMeasure::PerformanceMeasure(JS::Realm& realm, String const& name, HighResolutionTime::DOMHighResTimeStamp start_time, HighResolutionTime::DOMHighResTimeStamp duration, JS::Value detail) : PerformanceTimeline::PerformanceEntry(realm, name, start_time, duration) , m_detail(detail) { } PerformanceMeasure::~PerformanceMeasure() = default; WebIDL::ExceptionOr> PerformanceMeasure::create(JS::Realm& realm, String const& measure_name, HighResolutionTime::DOMHighResTimeStamp start_time, HighResolutionTime::DOMHighResTimeStamp duration, JS::Value detail) { return MUST_OR_THROW_OOM(realm.heap().allocate(realm, realm, measure_name, start_time, duration, detail)); } FlyString const& PerformanceMeasure::entry_type() const { return PerformanceTimeline::EntryTypes::measure; } JS::ThrowCompletionOr PerformanceMeasure::initialize(JS::Realm& realm) { MUST_OR_THROW_OOM(Base::initialize(realm)); set_prototype(&Bindings::ensure_web_prototype(realm, "PerformanceMeasure")); return {}; } void PerformanceMeasure::visit_edges(JS::Cell::Visitor& visitor) { Base::visit_edges(visitor); visitor.visit(m_detail); } }