diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2015-12-27 03:24:38 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2015-12-27 03:24:38 +0530 |
commit | 941653da653a1925ade35597e97f61a6a8a0018d (patch) | |
tree | 0f47932193d04177440e79fb96b41eeb5569aa04 /components/script | |
parent | d2e7fd82213a6b2df6703dc6f9ace70e49762c5a (diff) | |
parent | 655268d1117c81b05721f65ca5ee7a0ed2670986 (diff) | |
download | servo-941653da653a1925ade35597e97f61a6a8a0018d.tar.gz servo-941653da653a1925ade35597e97f61a6a8a0018d.zip |
Auto merge of #8958 - jkachmar:separate-layout-msg, r=KiChjang
Separate script and layout messages, issue #8843
Separated layout-specific messages to the constellation out from the `ScriptMsg` enum into a `LayoutMsg` enum within `script_traits/script_msg.rs`, addresses [#8843](https://github.com/servo/servo/issues/8843).
I initially tried to move `LayoutMsg` into `layout_traits/lib.rs`, but this introduced a cyclic dependency: `layout_traits` depends on `script_traits` for the `LayoutTaskFactory` implementation, and `script_traits/script_task.rs` now depends on `LayoutMsg` for new layout channels in `InitialScriptState` and `ScriptTask`.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8958)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 9 | ||||
-rw-r--r-- | components/script/layout_interface.rs | 4 | ||||
-rw-r--r-- | components/script/script_task.rs | 8 |
3 files changed, 16 insertions, 5 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index cbe870f073c..496d70add18 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -63,7 +63,7 @@ use net_traits::storage_task::StorageType; use profile_traits::mem::ProfilerChan as MemProfilerChan; use profile_traits::time::ProfilerChan as TimeProfilerChan; use script_task::ScriptChan; -use script_traits::{ScriptMsg, TimerEventId, TimerSource, UntrustedNodeAddress}; +use script_traits::{LayoutMsg, ScriptMsg, TimerEventId, TimerSource, UntrustedNodeAddress}; use selectors::parser::PseudoElement; use selectors::states::*; use serde::{Deserialize, Serialize}; @@ -306,6 +306,13 @@ impl JSTraceable for ConstellationChan<ScriptMsg> { } } +impl JSTraceable for ConstellationChan<LayoutMsg> { + #[inline] + fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + impl JSTraceable for Box<ScriptChan + Send> { #[inline] fn trace(&self, _trc: *mut JSTracer) { diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index a533fd6418d..4570192f6fb 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -18,8 +18,8 @@ use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use msg::constellation_msg::{WindowSizeData}; use net_traits::image_cache_task::ImageCacheTask; use profile_traits::mem::ReportsChan; -use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel}; -use script_traits::{ScriptMsg as ConstellationMsg, UntrustedNodeAddress}; +use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; +use script_traits::{OpaqueScriptLayoutChannel, UntrustedNodeAddress}; use selectors::parser::PseudoElement; use std::any::Any; use std::sync::Arc; diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 953bf3dacde..b07b5086f45 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -80,7 +80,7 @@ use profile_traits::time::{self, ProfilerCategory, profile}; use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent, ResizeEvent}; use script_traits::CompositorEvent::{TouchEvent}; use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult, InitialScriptState, NewLayoutInfo}; -use script_traits::{OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg}; +use script_traits::{LayoutMsg, OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg}; use script_traits::{ScriptTaskFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource}; use script_traits::{TouchEventType, TouchId}; use std::any::Any; @@ -406,6 +406,9 @@ pub struct ScriptTask { /// For communicating load url messages to the constellation constellation_chan: ConstellationChan<ConstellationMsg>, + /// For communicating layout messages to the constellation + layout_to_constellation_chan: ConstellationChan<LayoutMsg>, + /// A handle to the compositor for communicating ready state messages. compositor: DOMRefCell<IpcSender<ScriptToCompositorMsg>>, @@ -669,6 +672,7 @@ impl ScriptTask { control_chan: state.control_chan, control_port: control_port, constellation_chan: state.constellation_chan, + layout_to_constellation_chan: state.layout_to_constellation_chan, compositor: DOMRefCell::new(state.compositor), time_profiler_chan: state.time_profiler_chan, mem_profiler_chan: state.mem_profiler_chan, @@ -1195,7 +1199,7 @@ impl ScriptTask { is_parent: false, layout_pair: layout_pair, pipeline_port: pipeline_port, - constellation_chan: self.constellation_chan.clone(), + constellation_chan: self.layout_to_constellation_chan.clone(), failure: failure, paint_chan: paint_chan, script_chan: self.control_chan.clone(), |