aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_interface.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-07-13 19:59:13 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-07-14 15:09:16 -0700
commite5b1ec4078e1c04fd624709500e9c3a9ae4da988 (patch)
treeccaa6c59684a2616f4814b1981d8c55589e52e21 /components/script/layout_interface.rs
parent64751b8eef5b95de9ac3b9a382b4cb4408cb90c0 (diff)
downloadservo-e5b1ec4078e1c04fd624709500e9c3a9ae4da988.tar.gz
servo-e5b1ec4078e1c04fd624709500e9c3a9ae4da988.zip
script: Split `Pipeline::create` into chrome process and content
process parts. This will make it easier to adapt to IPC. The trickiest part here was to make script tasks spawn new layout tasks directly instead of having the pipeline do it for them. The latter approach will not work in multiprocess mode, because layout and script must run in the same address space and the pipeline cannot inject tasks into another process.
Diffstat (limited to 'components/script/layout_interface.rs')
-rw-r--r--components/script/layout_interface.rs31
1 files changed, 26 insertions, 5 deletions
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 7db08689279..3c26f062214 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -10,15 +10,17 @@ use dom::node::LayoutData;
use euclid::point::Point2D;
use euclid::rect::Rect;
-use ipc_channel::ipc::IpcSender;
+use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::uintptr_t;
use msg::compositor_msg::LayerId;
-use msg::constellation_msg::{PipelineExitType, WindowSizeData};
+use msg::constellation_msg::{ConstellationChan, Failure, PipelineExitType, PipelineId};
+use msg::constellation_msg::{WindowSizeData};
use msg::compositor_msg::Epoch;
+use net_traits::image_cache_task::ImageCacheTask;
use net_traits::PendingAsyncLoad;
use profile_traits::mem::{Reporter, ReportsChan};
-use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel, UntrustedNodeAddress};
-use script_traits::StylesheetLoadResponder;
+use script_traits::{ConstellationControlMsg, LayoutControlMsg, ScriptControlChan};
+use script_traits::{OpaqueScriptLayoutChannel, StylesheetLoadResponder, UntrustedNodeAddress};
use std::any::Any;
use std::sync::mpsc::{channel, Receiver, Sender};
use style::animation::PropertyAnimation;
@@ -72,7 +74,12 @@ pub enum Msg {
ExitNow(PipelineExitType),
/// Get the last epoch counter for this layout task.
- GetCurrentEpoch(IpcSender<Epoch>)
+ GetCurrentEpoch(IpcSender<Epoch>),
+
+ /// Creates a new layout task.
+ ///
+ /// This basically exists to keep the script-layout dependency one-way.
+ CreateLayoutTask(NewLayoutTaskInfo),
}
/// Synchronous messages that script can send to layout.
@@ -209,3 +216,17 @@ impl Animation {
}
}
+pub struct NewLayoutTaskInfo {
+ pub id: PipelineId,
+ pub url: Url,
+ pub is_parent: bool,
+ pub layout_pair: OpaqueScriptLayoutChannel,
+ pub pipeline_port: IpcReceiver<LayoutControlMsg>,
+ pub constellation_chan: ConstellationChan,
+ pub failure: Failure,
+ pub script_chan: Sender<ConstellationControlMsg>,
+ pub image_cache_task: ImageCacheTask,
+ pub paint_chan: Box<Any + Send>,
+ pub layout_shutdown_chan: Sender<()>,
+}
+