1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibWeb: Move dispatching timeupdate events to a helper for tracking

For some media APIs, we will need to know whether we are currently in an
event handler for the timeupdate event, and the last time we fired the
event.
This commit is contained in:
Timothy Flynn 2023-04-10 09:52:53 -04:00 committed by Linus Groh
parent 6c7b3c56f2
commit 2ef4a51c39
2 changed files with 18 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/Time.h>
#include <AK/Variant.h>
#include <LibJS/Heap/MarkedVector.h>
#include <LibJS/SafeFunction.h>
@ -87,6 +88,8 @@ private:
void set_paused(bool);
void set_duration(double);
WebIDL::ExceptionOr<void> dispatch_time_update_event();
JS::MarkedVector<JS::NonnullGCPtr<WebIDL::Promise>> take_pending_play_promises();
void resolve_pending_play_promises(ReadonlySpan<JS::NonnullGCPtr<WebIDL::Promise>> promises);
void reject_pending_play_promises(ReadonlySpan<JS::NonnullGCPtr<WebIDL::Promise>> promises, JS::NonnullGCPtr<WebIDL::DOMException> error);
@ -126,6 +129,9 @@ private:
// https://html.spec.whatwg.org/multipage/media.html#media-data
ByteBuffer m_media_data;
bool m_running_time_update_event_handler { false };
Optional<Time> m_last_time_update_event_time;
JS::GCPtr<Fetch::Infrastructure::FetchController> m_fetch_controller;
};