mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 21:45:08 +00:00
LibWeb: Move unsafe_shared_current_time() to HighResolutionTime
This doesn't belong on the EventLoop at all, as far as I can tell.
This commit is contained in:
parent
ff9a80f54f
commit
4ea6cc56be
10 changed files with 31 additions and 25 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HighResolutionTime/CoarsenTime.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
#include <LibWeb/Platform/Timer.h>
|
||||
|
@ -92,7 +93,7 @@ void EventLoop::process()
|
|||
// FIXME: 'current high resolution time' in hr-time-3 takes a global object,
|
||||
// the HTML spec has not been updated to reflect this, let's use the shared timer.
|
||||
// - https://github.com/whatwg/html/issues/7776
|
||||
double task_start_time = unsafe_shared_current_time();
|
||||
double task_start_time = HighResolutionTime::unsafe_shared_current_time();
|
||||
|
||||
// 3. Let taskQueue be one of the event loop's task queues, chosen in an implementation-defined manner,
|
||||
// with the constraint that the chosen task queue must contain at least one runnable task.
|
||||
|
@ -204,7 +205,7 @@ void EventLoop::process()
|
|||
// FIXME: has_a_rendering_opportunity is always true
|
||||
if (m_type == Type::Window && !task_queue.has_runnable_tasks() && m_microtask_queue.is_empty() /*&& !has_a_rendering_opportunity*/) {
|
||||
// 1. Set this event loop's last idle period start time to the current high resolution time.
|
||||
m_last_idle_period_start_time = unsafe_shared_current_time();
|
||||
m_last_idle_period_start_time = HighResolutionTime::unsafe_shared_current_time();
|
||||
|
||||
// 2. Let computeDeadline be the following steps:
|
||||
// NOTE: instead of passing around a function we use this event loop, which has compute_deadline()
|
||||
|
@ -375,12 +376,6 @@ Vector<JS::Handle<HTML::Window>> EventLoop::same_loop_windows() const
|
|||
return windows;
|
||||
}
|
||||
|
||||
// https://w3c.github.io/hr-time/#dfn-unsafe-shared-current-time
|
||||
double EventLoop::unsafe_shared_current_time() const
|
||||
{
|
||||
return Time::now_monotonic().to_nanoseconds() / 1e6;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model:last-idle-period-start-time
|
||||
double EventLoop::compute_deadline() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue