begin messageport, transferable objects, impl

Accept transfer argument for StructuredCloneData::write

Allow structured clone reads to return a boolean

Add Transferable trait

Add basic skeletons to MessagePort

Implement transfer and transfer-receiving steps on MessagePort

Use transfer and transfer_receive in StructuredClone callbacks

Implement MessageChannel

Freeze the array object for the MessageEvent ports attribute

Implement transfer argument on window.postMessage

Use ReentrantMutex instead for MessagePortInternal

Accept origin as a parameter in dispatch_jsval

Fix BorrowMut crash with pending_port_message

Detach port on closure and check for detached during transfer

Enable webmessaging tests

fix webidl

fix
This commit is contained in:
Keith Yeung 2016-12-11 03:52:08 -08:00 committed by Gregory Terzian
parent 605ddbecd4
commit c3b17c1201
37 changed files with 801 additions and 81 deletions

View file

@ -81,6 +81,7 @@ use crate::task_source::history_traversal::HistoryTraversalTaskSource;
use crate::task_source::media_element::MediaElementTaskSource;
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::performance_timeline::PerformanceTimelineTaskSource;
use crate::task_source::port_message::PortMessageQueue;
use crate::task_source::remote_event::RemoteEventTaskSource;
use crate::task_source::user_interaction::UserInteractionTaskSource;
use crate::task_source::websocket::WebsocketTaskSource;
@ -566,6 +567,8 @@ pub struct ScriptThread {
performance_timeline_task_sender: Box<dyn ScriptChan>,
port_message_sender: Box<dyn ScriptChan>,
remote_event_task_sender: Box<dyn ScriptChan>,
/// A channel to hand out to threads that need to respond to a message from the script thread.
@ -1296,6 +1299,7 @@ impl ScriptThread {
media_element_task_sender: chan.clone(),
user_interaction_task_sender: chan.clone(),
networking_task_sender: boxed_script_sender.clone(),
port_message_sender: boxed_script_sender.clone(),
file_reading_task_sender: boxed_script_sender.clone(),
performance_timeline_task_sender: boxed_script_sender.clone(),
remote_event_task_sender: boxed_script_sender.clone(),
@ -1656,6 +1660,7 @@ impl ScriptThread {
ScriptThreadEventCategory::PerformanceTimelineTask => {
ScriptHangAnnotation::PerformanceTimelineTask
},
ScriptThreadEventCategory::PortMessage => ScriptHangAnnotation::PortMessage,
};
self.background_hang_monitor
.notify_activity(HangAnnotation::Script(hang_annotation));
@ -1756,6 +1761,7 @@ impl ScriptThread {
ScriptThreadEventCategory::ImageCacheMsg => ProfilerCategory::ScriptImageCacheMsg,
ScriptThreadEventCategory::InputEvent => ProfilerCategory::ScriptInputEvent,
ScriptThreadEventCategory::NetworkEvent => ProfilerCategory::ScriptNetworkEvent,
ScriptThreadEventCategory::PortMessage => ProfilerCategory::ScriptPortMessage,
ScriptThreadEventCategory::Resize => ProfilerCategory::ScriptResize,
ScriptThreadEventCategory::ScriptEvent => ProfilerCategory::ScriptEvent,
ScriptThreadEventCategory::SetScrollState => ProfilerCategory::ScriptSetScrollState,
@ -2780,6 +2786,10 @@ impl ScriptThread {
NetworkingTaskSource(self.networking_task_sender.clone(), pipeline_id)
}
pub fn port_message_queue(&self, pipeline_id: PipelineId) -> PortMessageQueue {
PortMessageQueue(self.port_message_sender.clone(), pipeline_id)
}
pub fn file_reading_task_source(&self, pipeline_id: PipelineId) -> FileReadingTaskSource {
FileReadingTaskSource(self.file_reading_task_sender.clone(), pipeline_id)
}
@ -3177,6 +3187,7 @@ impl ScriptThread {
self.networking_task_source(incomplete.pipeline_id),
self.performance_timeline_task_source(incomplete.pipeline_id)
.clone(),
self.port_message_queue(incomplete.pipeline_id),
self.user_interaction_task_source(incomplete.pipeline_id),
self.remote_event_task_source(incomplete.pipeline_id),
self.websocket_task_source(incomplete.pipeline_id),