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.
This commit is contained in:
Patrick Walton 2015-07-13 17:02:35 -07:00
parent 886c08c393
commit bb99b2f3c8
39 changed files with 694 additions and 365 deletions

View file

@ -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> {

View file

@ -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,6 +332,13 @@ impl<A,B> JSTraceable for fn(A) -> B {
}
}
impl<T> JSTraceable for IpcSender<T> where T: Deserialize + Serialize {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
impl JSTraceable for ScriptListener {
#[inline]
fn trace(&self, _: *mut JSTracer) {
@ -346,13 +353,6 @@ impl JSTraceable for Box<LayoutRPC+'static> {
}
}
impl<T> JSTraceable for IpcSender<T> where T: Serialize {
#[inline]
fn trace(&self, _: *mut JSTracer) {
// Do nothing
}
}
impl JSTraceable for () {
#[inline]
fn trace(&self, _trc: *mut JSTracer) {