mirror of
https://github.com/RGBCube/serenity
synced 2025-06-02 08:08:11 +00:00

These instances were detected by searching for files that include AK/StdLibExtras.h, but don't match the regex: \\b(abs|AK_REPLACED_STD_NAMESPACE|array_size|ceil_div|clamp|exchange|for ward|is_constant_evaluated|is_power_of_two|max|min|mix|move|_RawPtr|RawP tr|round_up_to_power_of_two|swap|to_underlying)\\b (Without the linebreaks.) This regex is pessimistic, so there might be more files that don't actually use any "extra stdlib" functions. In theory, one might use LibCPP to detect things like this automatically, but let's do this one step after another.
36 lines
789 B
C++
36 lines
789 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibCore/ElapsedTimer.h>
|
|
#include <LibWeb/DOM/EventTarget.h>
|
|
|
|
namespace Web::HighResolutionTime {
|
|
|
|
class Performance final : public DOM::EventTarget {
|
|
WEB_PLATFORM_OBJECT(Performance, DOM::EventTarget);
|
|
|
|
public:
|
|
virtual ~Performance() override;
|
|
|
|
double now() const { return m_timer.elapsed(); }
|
|
double time_origin() const;
|
|
|
|
JS::GCPtr<NavigationTiming::PerformanceTiming> timing();
|
|
|
|
private:
|
|
explicit Performance(HTML::Window&);
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
JS::NonnullGCPtr<HTML::Window> m_window;
|
|
JS::GCPtr<NavigationTiming::PerformanceTiming> m_timing;
|
|
|
|
Core::ElapsedTimer m_timer;
|
|
};
|
|
|
|
}
|