Stop sending the renderer id to script.

This commit is contained in:
Ms2ger 2016-03-21 17:55:08 +01:00
parent 7e2e54326f
commit 63a00f4dbf
4 changed files with 8 additions and 10 deletions

View file

@ -1206,26 +1206,24 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
fn handle_create_canvas_paint_thread_msg(
&mut self,
size: &Size2D<i32>,
response_sender: IpcSender<(IpcSender<CanvasMsg>, usize)>) {
let id = self.canvas_paint_threads.len();
response_sender: IpcSender<IpcSender<CanvasMsg>>) {
let webrender_api = self.webrender_api_sender.clone();
let (out_of_process_sender, in_process_sender) = CanvasPaintThread::start(*size,
webrender_api);
self.canvas_paint_threads.push(in_process_sender);
response_sender.send((out_of_process_sender, id)).unwrap()
response_sender.send(out_of_process_sender).unwrap()
}
fn handle_create_webgl_paint_thread_msg(
&mut self,
size: &Size2D<i32>,
attributes: GLContextAttributes,
response_sender: IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>) {
response_sender: IpcSender<Result<IpcSender<CanvasMsg>, String>>) {
let webrender_api = self.webrender_api_sender.clone();
let response = match WebGLPaintThread::start(*size, attributes, webrender_api) {
Ok((out_of_process_sender, in_process_sender)) => {
let id = self.webgl_paint_threads.len();
self.webgl_paint_threads.push(in_process_sender);
Ok((out_of_process_sender, id))
Ok(out_of_process_sender)
},
Err(msg) => Err(msg),
};

View file

@ -124,7 +124,7 @@ impl CanvasRenderingContext2D {
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
constellation_chan.0.send(ConstellationMsg::CreateCanvasPaintThread(size, sender)).unwrap();
let (ipc_renderer, _) = receiver.recv().unwrap();
let ipc_renderer = receiver.recv().unwrap();
CanvasRenderingContext2D {
reflector_: Reflector::new(),
ipc_renderer: ipc_renderer,

View file

@ -94,7 +94,7 @@ impl WebGLRenderingContext {
.unwrap();
let result = receiver.recv().unwrap();
result.map(|(ipc_renderer, _)| {
result.map(|ipc_renderer| {
WebGLRenderingContext {
reflector_: Reflector::new(),
ipc_renderer: ipc_renderer,

View file

@ -39,12 +39,12 @@ pub enum ScriptMsg {
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
CreateCanvasPaintThread(Size2D<i32>, IpcSender<(IpcSender<CanvasMsg>, usize)>),
CreateCanvasPaintThread(Size2D<i32>, IpcSender<IpcSender<CanvasMsg>>),
/// Requests that a new WebGL thread be created. (This is done in the constellation because
/// WebGL uses the GPU and we don't want to give untrusted content access to the GPU.)
CreateWebGLPaintThread(Size2D<i32>,
GLContextAttributes,
IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>),
IpcSender<Result<IpcSender<CanvasMsg>, String>>),
/// Dispatched after the DOM load event has fired on a document
/// Causes a `load` event to be dispatched to any enclosing frame context element
/// for the given pipeline.