diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp index e77bc118bbf..67b34d3b700 100644 --- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp +++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp @@ -173,7 +173,7 @@ void on_max_age_attribute(ParsedCookie& parsed_cookie, StringView attribute_valu parsed_cookie.expiry_time_from_max_age_attribute = UnixDateTime::earliest(); } else { // Otherwise, let the expiry-time be the current date and time plus delta-seconds seconds. - parsed_cookie.expiry_time_from_max_age_attribute = UnixDateTime::now() + Duration::from_seconds(*delta_seconds); + parsed_cookie.expiry_time_from_max_age_attribute = UnixDateTime::now() + AK::Duration::from_seconds(*delta_seconds); } } } diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp index a38760e724f..8389254ac69 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp @@ -233,24 +233,24 @@ bool Response::is_stale() const u64 Response::current_age() const { // The term "age_value" denotes the value of the Age header field (Section 5.1), in a form appropriate for arithmetic operation; or 0, if not available. - Optional age; + Optional age; if (auto const age_header = header_list()->get("Age"sv.bytes()); age_header.has_value()) { if (auto converted_age = StringView { *age_header }.to_number(); converted_age.has_value()) - age = Duration::from_seconds(converted_age.value()); + age = AK::Duration::from_seconds(converted_age.value()); } - auto const age_value = age.value_or(Duration::from_seconds(0)); + auto const age_value = age.value_or(AK::Duration::from_seconds(0)); // The term "date_value" denotes the value of the Date header field, in a form appropriate for arithmetic operations. See Section 6.6.1 of [HTTP] for the definition of the Date header field and for requirements regarding responses without it. // FIXME: Do we have a parser for HTTP-date? - auto const date_value = UnixDateTime::now() - Duration::from_seconds(5); + auto const date_value = UnixDateTime::now() - AK::Duration::from_seconds(5); // The term "now" means the current value of this implementation's clock (Section 5.6.7 of [HTTP]). auto const now = UnixDateTime::now(); // The value of the clock at the time of the request that resulted in the stored response. // FIXME: Let's get the correct time. - auto const request_time = UnixDateTime::now() - Duration::from_seconds(5); + auto const request_time = UnixDateTime::now() - AK::Duration::from_seconds(5); // The value of the clock at the time the response was received. auto const response_time = m_response_time; diff --git a/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp b/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp index 5f5e1395be0..570e06ad778 100644 --- a/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp +++ b/Userland/Libraries/LibWeb/HTML/AudioTrack.cpp @@ -70,7 +70,7 @@ void AudioTrack::pause(Badge) m_audio_plugin->pause_playback(); } -Duration AudioTrack::duration() +AK::Duration AudioTrack::duration() { return m_audio_plugin->duration(); } diff --git a/Userland/Libraries/LibWeb/HTML/AudioTrack.h b/Userland/Libraries/LibWeb/HTML/AudioTrack.h index 47823091e42..76f6f1c3af7 100644 --- a/Userland/Libraries/LibWeb/HTML/AudioTrack.h +++ b/Userland/Libraries/LibWeb/HTML/AudioTrack.h @@ -25,7 +25,7 @@ public: void play(Badge); void pause(Badge); - Duration duration(); + AK::Duration duration(); void seek(double, MediaSeekMode); void update_volume(); diff --git a/Userland/Libraries/LibWeb/HTML/EventSource.cpp b/Userland/Libraries/LibWeb/HTML/EventSource.cpp index b364e703116..a0fa53edde7 100644 --- a/Userland/Libraries/LibWeb/HTML/EventSource.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventSource.cpp @@ -399,7 +399,7 @@ void EventSource::process_field(StringView field, StringView value) // If the field value consists of only ASCII digits, then interpret the field value as an integer in base ten, // and set the event stream's reconnection time to that integer. Otherwise, ignore the field. if (auto retry = value.to_number(); retry.has_value()) - m_reconnection_time = Duration::from_seconds(*retry); + m_reconnection_time = AK::Duration::from_seconds(*retry); } // -> Otherwise else { diff --git a/Userland/Libraries/LibWeb/HTML/EventSource.h b/Userland/Libraries/LibWeb/HTML/EventSource.h index 26998dd0eaf..b6185f3333c 100644 --- a/Userland/Libraries/LibWeb/HTML/EventSource.h +++ b/Userland/Libraries/LibWeb/HTML/EventSource.h @@ -82,7 +82,7 @@ private: JS::GCPtr m_request; // https://html.spec.whatwg.org/multipage/server-sent-events.html#concept-event-stream-reconnection-time - Duration m_reconnection_time { Duration::from_seconds(3) }; + AK::Duration m_reconnection_time { AK::Duration::from_seconds(3) }; // https://html.spec.whatwg.org/multipage/server-sent-events.html#concept-event-stream-last-event-id String m_last_event_id; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index ece05e94f2d..bf3f1df02b0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -957,7 +957,7 @@ Vector HTMLFormElement::supported_property_names() const Name, Past, } source; - Duration age; + AK::Duration age; }; Vector sourced_names; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp index fb9bcd753bb..9d445ecdd79 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp @@ -132,7 +132,7 @@ void HTMLVideoElement::on_paused() void HTMLVideoElement::on_seek(double position, MediaSeekMode seek_mode) { if (m_video_track) - m_video_track->seek(Duration::from_milliseconds(position * 1000.0), seek_mode); + m_video_track->seek(AK::Duration::from_milliseconds(position * 1000.0), seek_mode); } // https://html.spec.whatwg.org/multipage/media.html#attr-video-poster diff --git a/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp b/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp index 4c0eb73972a..751fc90b65a 100644 --- a/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp +++ b/Userland/Libraries/LibWeb/HTML/VideoTrack.cpp @@ -103,17 +103,17 @@ void VideoTrack::stop_video(Badge) m_playback_manager->terminate_playback(); } -Duration VideoTrack::position() const +AK::Duration VideoTrack::position() const { return m_playback_manager->current_playback_time(); } -Duration VideoTrack::duration() const +AK::Duration VideoTrack::duration() const { return m_playback_manager->selected_video_track().video_data().duration; } -void VideoTrack::seek(Duration position, MediaSeekMode seek_mode) +void VideoTrack::seek(AK::Duration position, MediaSeekMode seek_mode) { switch (seek_mode) { case MediaSeekMode::Accurate: diff --git a/Userland/Libraries/LibWeb/HTML/VideoTrack.h b/Userland/Libraries/LibWeb/HTML/VideoTrack.h index 042fbce9427..1ed8b3e45ef 100644 --- a/Userland/Libraries/LibWeb/HTML/VideoTrack.h +++ b/Userland/Libraries/LibWeb/HTML/VideoTrack.h @@ -27,9 +27,9 @@ public: void pause_video(Badge); void stop_video(Badge); - Duration position() const; - Duration duration() const; - void seek(Duration, MediaSeekMode); + AK::Duration position() const; + AK::Duration duration() const; + void seek(AK::Duration, MediaSeekMode); u64 pixel_width() const; u64 pixel_height() const; diff --git a/Userland/Libraries/LibWeb/Loader/LoadRequest.h b/Userland/Libraries/LibWeb/Loader/LoadRequest.h index 08d78b223b6..ef70a560c7a 100644 --- a/Userland/Libraries/LibWeb/Loader/LoadRequest.h +++ b/Userland/Libraries/LibWeb/Loader/LoadRequest.h @@ -41,7 +41,7 @@ public: void set_body(ByteBuffer body) { m_body = move(body); } void start_timer() { m_load_timer.start(); } - Duration load_time() const { return m_load_timer.elapsed_time(); } + AK::Duration load_time() const { return m_load_timer.elapsed_time(); } JS::GCPtr page() const { return m_page.ptr(); } void set_page(Page& page) { m_page = page; } diff --git a/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.cpp b/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.cpp index 3e3c1ba54c6..e27672cd6f3 100644 --- a/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.cpp +++ b/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.cpp @@ -39,7 +39,7 @@ ErrorOr> AudioCodecPlugin::read_samples_from_loader(Au return buffer_or_error.release_value(); } -Duration AudioCodecPlugin::set_loader_position(Audio::Loader& loader, double position, Duration duration) +AK::Duration AudioCodecPlugin::set_loader_position(Audio::Loader& loader, double position, AK::Duration duration) { if (loader.total_samples() == 0) return current_loader_position(loader); @@ -51,12 +51,12 @@ Duration AudioCodecPlugin::set_loader_position(Audio::Loader& loader, double pos return current_loader_position(loader); } -Duration AudioCodecPlugin::current_loader_position(Audio::Loader const& loader) +AK::Duration AudioCodecPlugin::current_loader_position(Audio::Loader const& loader) { auto samples_played = static_cast(loader.loaded_samples()); auto sample_rate = static_cast(loader.sample_rate()); - return Duration::from_milliseconds(static_cast(samples_played / sample_rate * 1000.0)); + return AK::Duration::from_milliseconds(static_cast(samples_played / sample_rate * 1000.0)); } } diff --git a/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.h b/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.h index 7cf0a540347..6b53f401b39 100644 --- a/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.h +++ b/Userland/Libraries/LibWeb/Platform/AudioCodecPlugin.h @@ -24,17 +24,17 @@ public: virtual ~AudioCodecPlugin(); static ErrorOr> read_samples_from_loader(Audio::Loader&, size_t samples_to_load); - static Duration set_loader_position(Audio::Loader&, double position, Duration duration); - static Duration current_loader_position(Audio::Loader const&); + static AK::Duration set_loader_position(Audio::Loader&, double position, AK::Duration duration); + static AK::Duration current_loader_position(Audio::Loader const&); virtual void resume_playback() = 0; virtual void pause_playback() = 0; virtual void set_volume(double) = 0; virtual void seek(double) = 0; - virtual Duration duration() = 0; + virtual AK::Duration duration() = 0; - Function on_playback_position_updated; + Function on_playback_position_updated; Function on_decoder_error; protected: diff --git a/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.cpp b/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.cpp index e0cd413bb4d..aa4a4b01923 100644 --- a/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.cpp +++ b/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.cpp @@ -17,12 +17,12 @@ namespace Web::Platform { constexpr int update_interval = 50; -static Duration timestamp_from_samples(i64 samples, u32 sample_rate) +static AK::Duration timestamp_from_samples(i64 samples, u32 sample_rate) { - return Duration::from_milliseconds(samples * 1000 / sample_rate); + return AK::Duration::from_milliseconds(samples * 1000 / sample_rate); } -static Duration get_loader_timestamp(NonnullRefPtr const& loader) +static AK::Duration get_loader_timestamp(NonnullRefPtr const& loader) { return timestamp_from_samples(loader->loaded_samples(), loader->sample_rate()); } @@ -80,7 +80,7 @@ ErrorOr> AudioCodecPluginAgnostic::creat return plugin; } -AudioCodecPluginAgnostic::AudioCodecPluginAgnostic(NonnullRefPtr loader, Duration duration, NonnullRefPtr update_timer) +AudioCodecPluginAgnostic::AudioCodecPluginAgnostic(NonnullRefPtr loader, AK::Duration duration, NonnullRefPtr update_timer) : m_loader(move(loader)) , m_duration(duration) , m_main_thread_event_loop(Core::EventLoop::current()) @@ -95,7 +95,7 @@ void AudioCodecPluginAgnostic::resume_playback() { m_paused = false; m_output->resume() - ->when_resolved([this](Duration new_device_time) { + ->when_resolved([this](AK::Duration new_device_time) { m_main_thread_event_loop.deferred_invoke([this, new_device_time]() { m_last_resume_in_device_time = new_device_time; m_update_timer->start(); @@ -164,7 +164,7 @@ void AudioCodecPluginAgnostic::seek(double position) }); } -Duration AudioCodecPluginAgnostic::duration() +AK::Duration AudioCodecPluginAgnostic::duration() { return m_duration; } diff --git a/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.h b/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.h index 12b5103720d..eda9b51977e 100644 --- a/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.h +++ b/Userland/Libraries/LibWeb/Platform/AudioCodecPluginAgnostic.h @@ -20,19 +20,19 @@ public: virtual void set_volume(double) override; virtual void seek(double) override; - virtual Duration duration() override; + virtual AK::Duration duration() override; private: - explicit AudioCodecPluginAgnostic(NonnullRefPtr loader, Duration, NonnullRefPtr update_timer); + explicit AudioCodecPluginAgnostic(NonnullRefPtr loader, AK::Duration, NonnullRefPtr update_timer); void update_timestamp(); NonnullRefPtr m_loader; RefPtr m_output { nullptr }; - Duration m_duration { Duration::zero() }; - Duration m_last_resume_in_media_time { Duration::zero() }; - Duration m_last_resume_in_device_time { Duration::zero() }; - Duration m_last_good_device_time { Duration::zero() }; + AK::Duration m_duration { AK::Duration::zero() }; + AK::Duration m_last_resume_in_media_time { AK::Duration::zero() }; + AK::Duration m_last_resume_in_device_time { AK::Duration::zero() }; + AK::Duration m_last_good_device_time { AK::Duration::zero() }; Core::EventLoop& m_main_thread_event_loop; NonnullRefPtr m_update_timer; bool m_paused { true }; diff --git a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp index 0821d169f72..5dcdf6e0d78 100644 --- a/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp +++ b/Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp @@ -332,7 +332,7 @@ ExecuteScriptResultSerialized execute_async_script(Web::Page& page, ByteString c auto start = MonotonicTime::now(); auto has_timed_out = [&] { - return timeout.has_value() && (MonotonicTime::now() - start) > Duration::from_seconds(static_cast(*timeout)); + return timeout.has_value() && (MonotonicTime::now() - start) > AK::Duration::from_seconds(static_cast(*timeout)); }; // AD-HOC: An execution context is required for Promise creation hooks.