diff options
author | Keith Yeung <kungfukeith11@gmail.com> | 2016-12-11 03:52:08 -0800 |
---|---|---|
committer | Gregory Terzian <gterzian@users.noreply.github.com> | 2019-10-19 14:12:22 +0800 |
commit | c3b17c1201441c9a24c4b272108aea0196fbf1b9 (patch) | |
tree | 0de5b1ba2b8579338ffcf5639e3e06797b9d95ff /components/script/script_thread.rs | |
parent | 605ddbecd4dfbbb67849cf63774b2d7635fc3601 (diff) | |
download | servo-c3b17c1201441c9a24c4b272108aea0196fbf1b9.tar.gz servo-c3b17c1201441c9a24c4b272108aea0196fbf1b9.zip |
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
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index b4363f5ada3..fac11949d70 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -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), |