aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/layout_interface.rs
diff options
context:
space:
mode:
authorTim Kuehn <tkuehn@cmu.edu>2013-06-13 16:32:13 -0700
committerTim Kuehn <tkuehn@cmu.edu>2013-06-14 21:46:29 -0700
commitb5dac3f426e1b30144ba9154059d9068aee16db0 (patch)
tree12e009478c934da6a1bc7d439068a3cf4134926d /src/components/script/layout_interface.rs
parent93eea6b2e87adedf833790d045bf69417ca9b7e3 (diff)
downloadservo-b5dac3f426e1b30144ba9154059d9068aee16db0.tar.gz
servo-b5dac3f426e1b30144ba9154059d9068aee16db0.zip
decouple script from compositor
communicate via layout refactor channel wrappers from *Task --> *Chan fix merge fallout
Diffstat (limited to 'src/components/script/layout_interface.rs')
-rw-r--r--src/components/script/layout_interface.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/components/script/layout_interface.rs b/src/components/script/layout_interface.rs
index f9ab0a8eb2e..d4d0aef7cf3 100644
--- a/src/components/script/layout_interface.rs
+++ b/src/components/script/layout_interface.rs
@@ -7,7 +7,7 @@
/// from layout.
use dom::node::{AbstractNode, ScriptView, LayoutView};
-use script_task::ScriptMsg;
+use script_task::{ScriptMsg, ScriptChan};
use core::comm::{Chan, SharedChan};
use geom::rect::Rect;
@@ -32,6 +32,9 @@ pub enum Msg {
/// FIXME(pcwalton): As noted below, this isn't very type safe.
QueryMsg(LayoutQuery, Chan<Result<LayoutResponse,()>>),
+ /// Routes a message (usually from the compositor) to the appropriate script task
+ RouteScriptMsg(ScriptMsg),
+
/// Requests that the layout task shut down and exit.
ExitMsg,
}
@@ -110,7 +113,7 @@ pub struct Reflow {
/// The URL of the page.
url: Url,
/// The channel through which messages can be sent back to the script task.
- script_chan: SharedChan<ScriptMsg>,
+ script_chan: ScriptChan,
/// The current window size.
window_size: Size2D<uint>,
/// The channel that we send a notification to.
@@ -119,7 +122,17 @@ pub struct Reflow {
/// Encapsulates a channel to the layout task.
#[deriving(Clone)]
-pub struct LayoutTask {
+pub struct LayoutChan {
chan: SharedChan<Msg>,
}
+impl LayoutChan {
+ pub fn new(chan: Chan<Msg>) -> LayoutChan {
+ LayoutChan {
+ chan: SharedChan::new(chan),
+ }
+ }
+ pub fn send(&self, msg: Msg) {
+ self.chan.send(msg);
+ }
+}