/src/serenity/Userland/Libraries/LibWeb/UserTiming/PerformanceMeasure.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Luke Wilde <lukew@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/Intrinsics.h> |
8 | | #include <LibWeb/Bindings/PerformanceMeasurePrototype.h> |
9 | | #include <LibWeb/HTML/StructuredSerialize.h> |
10 | | #include <LibWeb/HTML/Window.h> |
11 | | #include <LibWeb/HighResolutionTime/TimeOrigin.h> |
12 | | #include <LibWeb/NavigationTiming/EntryNames.h> |
13 | | #include <LibWeb/PerformanceTimeline/EntryTypes.h> |
14 | | #include <LibWeb/UserTiming/PerformanceMeasure.h> |
15 | | #include <LibWeb/WebIDL/ExceptionOr.h> |
16 | | |
17 | | namespace Web::UserTiming { |
18 | | |
19 | | JS_DEFINE_ALLOCATOR(PerformanceMeasure); |
20 | | |
21 | | PerformanceMeasure::PerformanceMeasure(JS::Realm& realm, String const& name, HighResolutionTime::DOMHighResTimeStamp start_time, HighResolutionTime::DOMHighResTimeStamp duration, JS::Value detail) |
22 | 0 | : PerformanceTimeline::PerformanceEntry(realm, name, start_time, duration) |
23 | 0 | , m_detail(detail) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | 0 | PerformanceMeasure::~PerformanceMeasure() = default; |
28 | | |
29 | | JS::NonnullGCPtr<PerformanceMeasure> PerformanceMeasure::create(JS::Realm& realm, String const& measure_name, HighResolutionTime::DOMHighResTimeStamp start_time, HighResolutionTime::DOMHighResTimeStamp duration, JS::Value detail) |
30 | 0 | { |
31 | 0 | return realm.heap().allocate<PerformanceMeasure>(realm, realm, measure_name, start_time, duration, detail); |
32 | 0 | } |
33 | | |
34 | | FlyString const& PerformanceMeasure::entry_type() const |
35 | 0 | { |
36 | 0 | return PerformanceTimeline::EntryTypes::measure; |
37 | 0 | } |
38 | | |
39 | | void PerformanceMeasure::initialize(JS::Realm& realm) |
40 | 0 | { |
41 | 0 | Base::initialize(realm); |
42 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceMeasure); |
43 | 0 | } |
44 | | |
45 | | void PerformanceMeasure::visit_edges(JS::Cell::Visitor& visitor) |
46 | 0 | { |
47 | 0 | Base::visit_edges(visitor); |
48 | 0 | visitor.visit(m_detail); |
49 | 0 | } |
50 | | |
51 | | } |