diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-12 17:33:32 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-12 17:33:32 +0530 |
commit | 6b1e73c1c0cf3fe2c935df0de667145bc6130461 (patch) | |
tree | 54159066b9b570760480963ef302b516a2708bb3 | |
parent | 6beebd3b4ffe8ded3b3e2b1788b9f98d10e36471 (diff) | |
parent | 1bde88395cd69ef68040982f3ee61204e50914dd (diff) | |
download | servo-6b1e73c1c0cf3fe2c935df0de667145bc6130461.tar.gz servo-6b1e73c1c0cf3fe2c935df0de667145bc6130461.zip |
Auto merge of #9240 - coder543:Refactoring, r=ecoal95
Refactor WebGLPaintTask to prevent creating extra IPC channels #9228
Closes #9228
I think this code will actually do what is desired now. I had to rebase off of master since WebGLPaintTask was renamed to WebGLPaintThread in a commit since last night.
I'm sorry this has been so much trouble so far. I'm still learning how things are done around here. I didn't even think about trailing whitespace, but now I know about the test-tidy tool.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9240)
<!-- Reviewable:end -->
-rw-r--r-- | components/canvas/webgl_paint_thread.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index 7558bc765cc..084ce49d491 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -187,10 +187,8 @@ impl WebGLPaintThread { /// sender for it. pub fn start(size: Size2D<i32>, attrs: GLContextAttributes) -> Result<(IpcSender<CanvasMsg>, Sender<CanvasMsg>), &'static str> { - let (out_of_process_chan, out_of_process_port) = ipc::channel::<CanvasMsg>().unwrap(); let (in_process_chan, in_process_port) = channel(); let (result_chan, result_port) = channel(); - ROUTER.route_ipc_receiver_to_mpsc_sender(out_of_process_port, in_process_chan.clone()); spawn_named("WebGLThread".to_owned(), move || { let mut painter = match WebGLPaintThread::new(size, attrs) { Ok(thread) => { @@ -230,7 +228,11 @@ impl WebGLPaintThread { } }); - result_port.recv().unwrap().map(|_| (out_of_process_chan, in_process_chan)) + result_port.recv().unwrap().map(|_| { + let (out_of_process_chan, out_of_process_port) = ipc::channel::<CanvasMsg>().unwrap(); + ROUTER.route_ipc_receiver_to_mpsc_sender(out_of_process_port, in_process_chan.clone()); + (out_of_process_chan, in_process_chan) + }) } #[inline] |