mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:07:44 +00:00
Everywhere: Use MonotonicTime instead of Duration
This is easily identifiable by anyone who uses Duration::now_monotonic, and any downstream users of that data.
This commit is contained in:
parent
b2e7b8cdff
commit
fc5cab5c21
29 changed files with 79 additions and 80 deletions
|
@ -1585,7 +1585,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::dispatch_time_update_event()
|
|||
ScopeGuard guard { [this] { m_running_time_update_event_handler = false; } };
|
||||
m_running_time_update_event_handler = true;
|
||||
|
||||
m_last_time_update_event_time = Duration::now_monotonic();
|
||||
m_last_time_update_event_time = MonotonicTime::now();
|
||||
|
||||
dispatch_event(TRY(DOM::Event::create(realm(), HTML::EventNames::timeupdate)));
|
||||
return {};
|
||||
|
@ -1617,7 +1617,7 @@ void HTMLMediaElement::time_marches_on(TimeMarchesOnReason reason)
|
|||
auto dispatch_event = true;
|
||||
|
||||
if (m_last_time_update_event_time.has_value()) {
|
||||
auto time_since_last_event = Duration::now_monotonic() - *m_last_time_update_event_time;
|
||||
auto time_since_last_event = MonotonicTime::now() - *m_last_time_update_event_time;
|
||||
dispatch_event = time_since_last_event.to_milliseconds() > 250;
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ private:
|
|||
Optional<DOM::DocumentLoadEventDelayer> m_delaying_the_load_event;
|
||||
|
||||
bool m_running_time_update_event_handler { false };
|
||||
Optional<Duration> m_last_time_update_event_time;
|
||||
Optional<MonotonicTime> m_last_time_update_event_time;
|
||||
|
||||
JS::GCPtr<DOM::DocumentObserver> m_document_observer;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ JS::GCPtr<NavigationTiming::PerformanceTiming> Performance::timing()
|
|||
|
||||
double Performance::time_origin() const
|
||||
{
|
||||
return static_cast<double>(m_timer.origin_time().to_milliseconds());
|
||||
return static_cast<double>(m_timer.origin_time().milliseconds());
|
||||
}
|
||||
|
||||
// https://w3c.github.io/user-timing/#mark-method
|
||||
|
|
|
@ -55,7 +55,7 @@ DOMHighResTimeStamp coarsened_shared_current_time(bool cross_origin_isolated_cap
|
|||
DOMHighResTimeStamp unsafe_shared_current_time()
|
||||
{
|
||||
// The unsafe shared current time must return the current value of the shared monotonic clock.
|
||||
return Duration::now_monotonic().to_nanoseconds() / 1e6;
|
||||
return MonotonicTime::now().truncated_seconds();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ ExecuteScriptResultSerialized execute_async_script(Web::Page& page, DeprecatedSt
|
|||
auto* window = page.top_level_browsing_context().active_window();
|
||||
auto& realm = window->realm();
|
||||
auto& vm = window->vm();
|
||||
auto start = Duration::now_monotonic();
|
||||
auto start = MonotonicTime::now();
|
||||
|
||||
// 4. Let promise be a new Promise.
|
||||
auto promise = JS::Promise::create(realm);
|
||||
|
@ -383,7 +383,7 @@ ExecuteScriptResultSerialized execute_async_script(Web::Page& page, DeprecatedSt
|
|||
vm.custom_data()->spin_event_loop_until([&] {
|
||||
if (script_promise.state() != JS::Promise::State::Pending)
|
||||
return true;
|
||||
if (timeout.has_value() && (Duration::now_monotonic() - start) > Duration::from_seconds(static_cast<i64>(*timeout)))
|
||||
if (timeout.has_value() && (MonotonicTime::now() - start) > Duration::from_seconds(static_cast<i64>(*timeout)))
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue