From 78ad47136713c7874988d2abbf8dd3618991f8ba Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 25 Apr 2023 08:54:04 -0400 Subject: [PATCH] LibWeb: Remove custom playback timer from HTMLMediaElement After the EventLoop changes, we do not need to override LibVideo's timer with a Qt timer for Ladybird. The timer callback provided here also does not need the JS::SafeFunction wrapper that Platform::Timer provides. --- .../LibWeb/HTML/HTMLMediaElement.cpp | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index c483bab47c..db2e59b2f4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -28,31 +28,10 @@ #include #include #include -#include #include namespace Web::HTML { -class MediaElementPlaybackTimer final : public Video::PlaybackTimer { -public: - static ErrorOr> create(int interval_ms, Function timeout_handler) - { - auto timer = Platform::Timer::create_single_shot(interval_ms, move(timeout_handler)); - return adopt_nonnull_own_or_enomem(new (nothrow) MediaElementPlaybackTimer(move(timer))); - } - - virtual void start() override { m_timer->start(); } - virtual void start(int interval_ms) override { m_timer->start(interval_ms); } - -private: - explicit MediaElementPlaybackTimer(NonnullRefPtr timer) - : m_timer(move(timer)) - { - } - - NonnullRefPtr m_timer; -}; - HTMLMediaElement::HTMLMediaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) , m_pending_play_promises(heap()) @@ -773,9 +752,7 @@ WebIDL::ExceptionOr HTMLMediaElement::process_media_data(Functionrealm(); auto& vm = realm.vm(); - auto playback_manager = Video::PlaybackManager::from_data(m_media_data, [](auto interval_ms, auto timeout_handler) { - return MediaElementPlaybackTimer::create(interval_ms, move(timeout_handler)); - }); + auto playback_manager = Video::PlaybackManager::from_data(m_media_data); // -> If the media data cannot be fetched at all, due to network errors, causing the user agent to give up trying to fetch the resource // -> If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all