aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-07-25 01:50:31 -0600
committerbors-servo <metajack+bors@gmail.com>2015-07-25 01:50:31 -0600
commit1764267379a00b96a1df89f3917299a0c6fd325c (patch)
tree15641e7ed77b46ab61bab772fa3c63b7e8e8d619 /components/script/dom/bindings
parent886c08c393f51499490702eaf97fc770273a2600 (diff)
parentbb99b2f3c8813919c476930c709b73d3cfbc8c83 (diff)
downloadservo-1764267379a00b96a1df89f3917299a0c6fd325c.tar.gz
servo-1764267379a00b96a1df89f3917299a0c6fd325c.zip
Auto merge of #6616 - pcwalton:canvas-webgl-ipc, r=jdm
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. r? @jdm <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6616) <!-- Reviewable:end -->
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