servo: Merge #11375 - Remove ScriptThread::layout_to_constellation_chan (from servo:layout_to_constellation_chan); r=mbrubeck
authorMs2ger <>
Wed, 25 May 2016 09:26:04 -0500
changeset 338908 2cb4eeaa7c00c95149a19b60d8d2891e5abba862
parent 338907 d91e53a6ad85cb2bd413a6766788312781e01098
child 338909 de6e4ef832af43120e69ad2d8929b4fbcdaca5ff
push id31307
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
servo: Merge #11375 - Remove ScriptThread::layout_to_constellation_chan (from servo:layout_to_constellation_chan); r=mbrubeck Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy --faster` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [x] These changes do not require tests because refactoring Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. Instead, pass it along in NewLayoutInfo when needed. Source-Repo: Source-Revision: f03e8fc937b5bc5b22c2595ffd17bee41a825b5f
--- a/servo/components/constellation/
+++ b/servo/components/constellation/
@@ -161,16 +161,17 @@ impl Pipeline {
                 let new_layout_info = NewLayoutInfo {
                     containing_pipeline_id: containing_pipeline_id,
                     subpage_id: subpage_id,
                     load_data: state.load_data.clone(),
                     paint_chan: layout_to_paint_chan.clone().to_opaque(),
                     panic_chan: state.panic_chan.clone(),
                     pipeline_port: pipeline_port,
+                    layout_to_constellation_chan: state.layout_to_constellation_chan.clone(),
                     layout_shutdown_chan: layout_shutdown_chan.clone(),
                     content_process_shutdown_chan: layout_content_process_shutdown_chan.clone(),
                 if let Err(e) = script_chan.send(ConstellationControlMsg::AttachLayout(new_layout_info)) {
                     warn!("Sending to script during pipeline creation failed ({})", e);
                 (script_chan, None, None)
@@ -405,17 +406,16 @@ impl UnprivilegedPipelineContent {
               STF: ScriptThreadFactory<Message=Message>
         let layout_pair = STF::create(InitialScriptState {
             parent_info: self.parent_info,
             control_chan: self.script_chan.clone(),
             control_port: mem::replace(&mut self.script_port, None).expect("No script port."),
             constellation_chan: self.constellation_chan.clone(),
-            layout_to_constellation_chan: self.layout_to_constellation_chan.clone(),
             scheduler_chan: self.scheduler_chan.clone(),
             panic_chan: self.panic_chan.clone(),
             bluetooth_thread: self.bluetooth_thread.clone(),
             resource_threads: self.resource_threads,
             image_cache_thread: self.image_cache_thread.clone(),
             time_profiler_chan: self.time_profiler_chan.clone(),
             mem_profiler_chan: self.mem_profiler_chan.clone(),
             devtools_chan: self.devtools_chan,
--- a/servo/components/script/
+++ b/servo/components/script/
@@ -74,18 +74,18 @@ use parse::html::{ParseContext, parse_ht
 use parse::xml::{self, parse_xml};
 use profile_traits::mem::{self, OpaqueSender, Report, ReportKind, ReportsChan};
 use profile_traits::time::{self, ProfilerCategory, profile};
 use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
 use script_runtime::{ScriptPort, StackRootTLS, new_rt_and_cx, get_reports};
 use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent};
 use script_traits::CompositorEvent::{TouchEvent, TouchpadPressureEvent};
 use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult};
-use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent, NewLayoutInfo};
-use script_traits::{LayoutMsg, ScriptMsg as ConstellationMsg};
+use script_traits::{InitialScriptState, MouseButton, MouseEventType, MozBrowserEvent};
+use script_traits::{NewLayoutInfo, ScriptMsg as ConstellationMsg};
 use script_traits::{ScriptThreadFactory, TimerEvent, TimerEventRequest, TimerSource};
 use script_traits::{TouchEventType, TouchId};
 use std::borrow::ToOwned;
 use std::cell::{Cell, RefCell};
 use std::collections::HashSet;
 use std::option::Option;
 use std::rc::Rc;
 use std::result::Result;
@@ -342,19 +342,16 @@ pub struct ScriptThread {
     /// The port on which the constellation and layout threads can communicate with the
     /// script thread.
     control_port: Receiver<ConstellationControlMsg>,
     /// For communicating load url messages to the constellation
     constellation_chan: IpcSender<ConstellationMsg>,
-    /// For communicating layout messages to the constellation
-    layout_to_constellation_chan: IpcSender<LayoutMsg>,
     /// The port on which we receive messages from the image cache
     image_cache_port: Receiver<ImageCacheResult>,
     /// The channel on which the image cache can send messages to ourself.
     image_cache_channel: ImageCacheChan,
     /// For providing contact with the time profiler.
     time_profiler_chan: time::ProfilerChan,
@@ -567,17 +564,16 @@ impl ScriptThread {
             user_interaction_task_source: UserInteractionTaskSource(chan.clone()),
             networking_task_source: NetworkingTaskSource(chan.clone()),
             history_traversal_task_source: HistoryTraversalTaskSource(chan.clone()),
             file_reading_task_source: FileReadingTaskSource(chan),
             control_chan: state.control_chan,
             control_port: control_port,
             constellation_chan: state.constellation_chan,
-            layout_to_constellation_chan: state.layout_to_constellation_chan,
             time_profiler_chan: state.time_profiler_chan,
             mem_profiler_chan: state.mem_profiler_chan,
             panic_chan: state.panic_chan,
             devtools_chan: state.devtools_chan,
             devtools_port: devtools_port,
             devtools_sender: ipc_devtools_sender,
@@ -1084,30 +1080,31 @@ impl ScriptThread {
         let NewLayoutInfo {
+            layout_to_constellation_chan,
         } = new_layout_info;
         let layout_pair = channel();
         let layout_chan = LayoutChan(layout_pair.0.clone());
         let layout_creation_info = NewLayoutThreadInfo {
             id: new_pipeline_id,
             url: load_data.url.clone(),
             is_parent: false,
             layout_pair: layout_pair,
             pipeline_port: pipeline_port,
-            constellation_chan: self.layout_to_constellation_chan.clone(),
+            constellation_chan: layout_to_constellation_chan,
             panic_chan: panic_chan,
             paint_chan: paint_chan,
             script_chan: self.control_chan.clone(),
             image_cache_thread: self.image_cache_thread.clone(),
             layout_shutdown_chan: layout_shutdown_chan,
             content_process_shutdown_chan: content_process_shutdown_chan,
--- a/servo/components/script_traits/
+++ b/servo/components/script_traits/
@@ -95,16 +95,18 @@ pub struct NewLayoutInfo {
     pub load_data: LoadData,
     /// The paint channel, cast to `OptionalOpaqueIpcSender`. This is really an
     /// `Sender<LayoutToPaintMsg>`.
     pub paint_chan: OptionalOpaqueIpcSender,
     /// A port on which layout can receive messages from the pipeline.
     pub pipeline_port: IpcReceiver<LayoutControlMsg>,
     /// A channel for sending panics on
     pub panic_chan: IpcSender<PanicMsg>,
+    /// A sender for the layout thread to communicate to the constellation.
+    pub layout_to_constellation_chan: IpcSender<LayoutMsg>,
     /// A shutdown channel so that layout can notify others when it's done.
     pub layout_shutdown_chan: IpcSender<()>,
     /// A shutdown channel so that layout can tell the content process to shut down when it's done.
     pub content_process_shutdown_chan: IpcSender<()>,
 /// Messages sent from the constellation or layout to the script thread.
 #[derive(Deserialize, Serialize)]
@@ -305,18 +307,16 @@ pub struct InitialScriptState {
     /// If `None`, this is the root.
     pub parent_info: Option<(PipelineId, SubpageId)>,
     /// A channel with which messages can be sent to us (the script thread).
     pub control_chan: IpcSender<ConstellationControlMsg>,
     /// A port on which messages sent by the constellation to script can be received.
     pub control_port: IpcReceiver<ConstellationControlMsg>,
     /// A channel on which messages can be sent to the constellation from script.
     pub constellation_chan: IpcSender<ScriptMsg>,
-    /// A channel for the layout thread to send messages to the constellation.
-    pub layout_to_constellation_chan: IpcSender<LayoutMsg>,
     /// A channel for sending panics to the constellation.
     pub panic_chan: IpcSender<PanicMsg>,
     /// A channel to schedule timer events.
     pub scheduler_chan: IpcSender<TimerEventRequest>,
     /// A channel to the resource manager thread.
     pub resource_threads: ResourceThreads,
     /// A channel to the bluetooth thread.
     pub bluetooth_thread: IpcSender<BluetoothMethodMsg>,