mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Add task source for media element
This commit is contained in:
parent
7a88a2e28a
commit
7b3cf27c69
5 changed files with 82 additions and 14 deletions
|
@ -278,7 +278,8 @@ impl HTMLMediaElement {
|
|||
let state = self.ready_state.get();
|
||||
|
||||
let window = window_from_node(self);
|
||||
let task_source = window.dom_manipulation_task_source();
|
||||
// FIXME(nox): Why are errors silenced here?
|
||||
let task_source = window.media_element_task_source();
|
||||
if self.Paused() {
|
||||
// Step 6.1.
|
||||
self.paused.set(false);
|
||||
|
@ -356,9 +357,7 @@ impl HTMLMediaElement {
|
|||
let window = window_from_node(self);
|
||||
let this = Trusted::new(self);
|
||||
let generation_id = self.generation_id.get();
|
||||
// FIXME(nox): Why are errors silenced here?
|
||||
// FIXME(nox): Media element event task source should be used here.
|
||||
let _ = window.dom_manipulation_task_source().queue(
|
||||
let _ = window.media_element_task_source().queue(
|
||||
task!(internal_pause_steps: move || {
|
||||
let this = this.root();
|
||||
if generation_id != this.generation_id.get() {
|
||||
|
@ -400,8 +399,7 @@ impl HTMLMediaElement {
|
|||
let this = Trusted::new(self);
|
||||
let generation_id = self.generation_id.get();
|
||||
// FIXME(nox): Why are errors silenced here?
|
||||
// FIXME(nox): Media element event task source should be used here.
|
||||
let _ = window.dom_manipulation_task_source().queue(
|
||||
let _ = window.media_element_task_source().queue(
|
||||
task!(notify_about_playing: move || {
|
||||
let this = this.root();
|
||||
if generation_id != this.generation_id.get() {
|
||||
|
@ -435,7 +433,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
|
||||
let window = window_from_node(self);
|
||||
let task_source = window.dom_manipulation_task_source();
|
||||
let task_source = window.media_element_task_source();
|
||||
|
||||
// Step 1.
|
||||
match (old_ready_state, ready_state) {
|
||||
|
@ -590,7 +588,7 @@ impl HTMLMediaElement {
|
|||
|
||||
// Step 8.
|
||||
let window = window_from_node(self);
|
||||
window.dom_manipulation_task_source().queue_simple_event(
|
||||
window.media_element_task_source().queue_simple_event(
|
||||
self.upcast(),
|
||||
atom!("loadstart"),
|
||||
&window,
|
||||
|
@ -667,7 +665,7 @@ impl HTMLMediaElement {
|
|||
|
||||
// Step 4.remote.1.2.
|
||||
let window = window_from_node(self);
|
||||
window.dom_manipulation_task_source().queue_simple_event(
|
||||
window.media_element_task_source().queue_simple_event(
|
||||
self.upcast(),
|
||||
atom!("suspend"),
|
||||
&window,
|
||||
|
@ -676,7 +674,7 @@ impl HTMLMediaElement {
|
|||
// Step 4.remote.1.3.
|
||||
let this = Trusted::new(self);
|
||||
window
|
||||
.dom_manipulation_task_source()
|
||||
.media_element_task_source()
|
||||
.queue(
|
||||
task!(set_media_delay_load_event_flag_to_false: move || {
|
||||
this.root().delay_load_event(false);
|
||||
|
@ -755,8 +753,7 @@ impl HTMLMediaElement {
|
|||
let generation_id = self.generation_id.get();
|
||||
self.take_pending_play_promises(Err(Error::NotSupported));
|
||||
// FIXME(nox): Why are errors silenced here?
|
||||
// FIXME(nox): Media element event task source should be used here.
|
||||
let _ = window.dom_manipulation_task_source().queue(
|
||||
let _ = window.media_element_task_source().queue(
|
||||
task!(dedicated_media_source_failure_steps: move || {
|
||||
let this = this.root();
|
||||
if generation_id != this.generation_id.get() {
|
||||
|
@ -813,7 +810,7 @@ impl HTMLMediaElement {
|
|||
}
|
||||
|
||||
let window = window_from_node(self);
|
||||
let task_source = window.dom_manipulation_task_source();
|
||||
let task_source = window.media_element_task_source();
|
||||
|
||||
// Step 5.
|
||||
let network_state = self.network_state.get();
|
||||
|
@ -1291,7 +1288,7 @@ impl FetchResponseListener for HTMLMediaElementContext {
|
|||
// => "If mode is remote" step 2
|
||||
if time::get_time() > self.next_progress_event {
|
||||
let window = window_from_node(&*elem);
|
||||
window.dom_manipulation_task_source().queue_simple_event(
|
||||
window.media_element_task_source().queue_simple_event(
|
||||
elem.upcast(),
|
||||
atom!("progress"),
|
||||
&window,
|
||||
|
|
|
@ -123,6 +123,7 @@ use task_source::TaskSourceName;
|
|||
use task_source::dom_manipulation::DOMManipulationTaskSource;
|
||||
use task_source::file_reading::FileReadingTaskSource;
|
||||
use task_source::history_traversal::HistoryTraversalTaskSource;
|
||||
use task_source::media_element::MediaElementTaskSource;
|
||||
use task_source::networking::NetworkingTaskSource;
|
||||
use task_source::performance_timeline::PerformanceTimelineTaskSource;
|
||||
use task_source::remote_event::RemoteEventTaskSource;
|
||||
|
@ -175,6 +176,8 @@ pub struct Window {
|
|||
#[ignore_malloc_size_of = "task sources are hard"]
|
||||
dom_manipulation_task_source: DOMManipulationTaskSource,
|
||||
#[ignore_malloc_size_of = "task sources are hard"]
|
||||
media_element_task_source: MediaElementTaskSource,
|
||||
#[ignore_malloc_size_of = "task sources are hard"]
|
||||
user_interaction_task_source: UserInteractionTaskSource,
|
||||
#[ignore_malloc_size_of = "task sources are hard"]
|
||||
networking_task_source: NetworkingTaskSource,
|
||||
|
@ -359,6 +362,10 @@ impl Window {
|
|||
self.dom_manipulation_task_source.clone()
|
||||
}
|
||||
|
||||
pub fn media_element_task_source(&self) -> MediaElementTaskSource {
|
||||
self.media_element_task_source.clone()
|
||||
}
|
||||
|
||||
pub fn user_interaction_task_source(&self) -> UserInteractionTaskSource {
|
||||
self.user_interaction_task_source.clone()
|
||||
}
|
||||
|
@ -2061,6 +2068,7 @@ impl Window {
|
|||
runtime: Rc<Runtime>,
|
||||
script_chan: MainThreadScriptChan,
|
||||
dom_manipulation_task_source: DOMManipulationTaskSource,
|
||||
media_element_task_source: MediaElementTaskSource,
|
||||
user_interaction_task_source: UserInteractionTaskSource,
|
||||
networking_task_source: NetworkingTaskSource,
|
||||
history_traversal_task_source: HistoryTraversalTaskSource,
|
||||
|
@ -2116,6 +2124,7 @@ impl Window {
|
|||
),
|
||||
script_chan,
|
||||
dom_manipulation_task_source,
|
||||
media_element_task_source,
|
||||
user_interaction_task_source,
|
||||
networking_task_source,
|
||||
history_traversal_task_source,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue