MediaSessionAction message from embedder to script thread

This commit is contained in:
Fernando Jiménez Moreno 2019-10-04 17:05:56 +02:00
parent 7101a9d070
commit 6233f78de4
5 changed files with 97 additions and 3 deletions

View file

@ -139,7 +139,7 @@ use script_traits::{
DiscardBrowsingContext, DocumentActivity, EventResult, HistoryEntryReplacement,
};
use script_traits::{InitialScriptState, JsEvalResult, LayoutMsg, LoadData, LoadOrigin};
use script_traits::{MouseButton, MouseEventType, NewLayoutInfo};
use script_traits::{MediaSessionActionType, MouseButton, MouseEventType, NewLayoutInfo};
use script_traits::{Painter, ProgressiveWebMetricType, ScriptMsg, ScriptThreadFactory};
use script_traits::{ScriptToConstellationChan, TimerEvent, TimerSchedulerMsg};
use script_traits::{TimerSource, TouchEventType, TouchId, UntrustedNodeAddress, WheelDelta};
@ -1720,6 +1720,7 @@ impl ScriptThread {
WebVREvents(id, ..) => Some(id),
PaintMetric(..) => None,
ExitFullScreen(id, ..) => Some(id),
MediaSessionAction(..) => None,
}
},
MixedMessage::FromDevtools(_) => None,
@ -1949,6 +1950,9 @@ impl ScriptThread {
ConstellationControlMsg::PaintMetric(pipeline_id, metric_type, metric_value) => {
self.handle_paint_metric(pipeline_id, metric_type, metric_value)
},
ConstellationControlMsg::MediaSessionAction(browsing_context_id, action) => {
self.handle_media_session_action(browsing_context_id, action)
},
msg @ ConstellationControlMsg::AttachLayout(..) |
msg @ ConstellationControlMsg::Viewport(..) |
msg @ ConstellationControlMsg::SetScrollState(..) |
@ -3932,6 +3936,14 @@ impl ScriptThread {
}
}
fn handle_media_session_action(
&self,
browsing_context_id: TopLevelBrowsingContextId,
action: MediaSessionActionType,
) {
// TODO
}
pub fn enqueue_microtask(job: Microtask) {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };