aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-07-13 17:02:35 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-07-25 00:50:12 -0700
commitbb99b2f3c8813919c476930c709b73d3cfbc8c83 (patch)
tree15641e7ed77b46ab61bab772fa3c63b7e8e8d619 /components/script/dom/bindings
parent886c08c393f51499490702eaf97fc770273a2600 (diff)
downloadservo-bb99b2f3c8813919c476930c709b73d3cfbc8c83.tar.gz
servo-bb99b2f3c8813919c476930c709b73d3cfbc8c83.zip
script: Make most of 2D canvas and WebGL run over IPC.
To actually make the multiprocess communication work, we'll need to reroute the task creation to the pipeline or the compositor. But this works as a first step.
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/global.rs10
-rw-r--r--components/script/dom/bindings/trace.rs8
2 files changed, 13 insertions, 5 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index 85dd955628b..5335db1d928 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -17,7 +17,7 @@ use dom::window::{self, WindowHelpers};
use devtools_traits::DevtoolsControlChan;
use script_task::{ScriptChan, ScriptPort, ScriptMsg, ScriptTask};
-use msg::constellation_msg::{PipelineId, WorkerId};
+use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
use net_traits::ResourceTask;
use profile_traits::mem;
@@ -91,6 +91,14 @@ impl<'a> GlobalRef<'a> {
}
}
+ /// Get a `ConstellationChan` to send messages to the constellation channel when available.
+ pub fn constellation_chan(&self) -> ConstellationChan {
+ match *self {
+ GlobalRef::Window(window) => window.constellation_chan(),
+ GlobalRef::Worker(worker) => worker.constellation_chan(),
+ }
+ }
+
/// Get a `DevtoolsControlChan` to send messages to Devtools
/// task when available.
pub fn devtools_chan(&self) -> Option<DevtoolsControlChan> {
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 079f1ecbafc..a2c82b80722 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -62,8 +62,8 @@ use msg::compositor_msg::ScriptListener;
use msg::constellation_msg::ConstellationChan;
use net_traits::image::base::Image;
use profile_traits::mem::ProfilerChan;
-use serde::Serialize;
use util::str::{LengthOrPercentageOrAuto};
+use serde::{Deserialize, Serialize};
use std::cell::{Cell, UnsafeCell, RefCell};
use std::collections::{HashMap, HashSet};
use std::collections::hash_state::HashState;
@@ -332,21 +332,21 @@ impl<A,B> JSTraceable for fn(A) -> B {
}
}
-impl JSTraceable for ScriptListener {
+impl<T> JSTraceable for IpcSender<T> where T: Deserialize + Serialize {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
-impl JSTraceable for Box<LayoutRPC+'static> {
+impl JSTraceable for ScriptListener {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
-impl<T> JSTraceable for IpcSender<T> where T: Serialize {
+impl JSTraceable for Box<LayoutRPC+'static> {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing