aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/layout_task.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-07-10 20:02:17 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-07-26 23:07:44 -0700
commit82b53d83ff6a85d337fdf0d322d0c5a0d334555b (patch)
tree7256bf28d766192e336410ef6b76fe8275df1d7a /components/layout/layout_task.rs
parent380de1ba821140b180ef137796e5c3097a953c11 (diff)
downloadservo-82b53d83ff6a85d337fdf0d322d0c5a0d334555b.tar.gz
servo-82b53d83ff6a85d337fdf0d322d0c5a0d334555b.zip
script: Make the `ImageCacheTask` use IPC.
This necessitated getting rid of the boxed trait object that was being be passed between the script task and the image cache task.
Diffstat (limited to 'components/layout/layout_task.rs')
-rw-r--r--components/layout/layout_task.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index a6c92306273..7d0df0fc5e6 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -68,7 +68,6 @@ use std::mem::transmute;
use std::ops::{Deref, DerefMut};
use std::sync::mpsc::{channel, Sender, Receiver, Select};
use std::sync::{Arc, Mutex, MutexGuard};
-use std::thread;
use style::computed_values::{filter, mix_blend_mode};
use style::media_queries::{MediaType, MediaQueryList, Device};
use style::selector_matching::Stylist;
@@ -327,16 +326,15 @@ impl LayoutTask {
// Create the channel on which new animations can be sent.
let (new_animations_sender, new_animations_receiver) = channel();
- let (image_cache_sender, image_cache_receiver) = channel();
let (canvas_layers_sender, canvas_layers_receiver) = channel();
- // Start a thread to proxy IPC messages from the layout thread to us.
- let (pipeline_sender, pipeline_receiver) = channel();
- thread::spawn(move || {
- while let Ok(message) = pipeline_port.recv() {
- pipeline_sender.send(message).unwrap()
- }
- });
+ // Proxy IPC messages from the pipeline to the layout thread.
+ let pipeline_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(pipeline_port);
+
+ // Ask the router to proxy IPC messages from the image cache task to the layout thread.
+ let (ipc_image_cache_sender, ipc_image_cache_receiver) = ipc::channel().unwrap();
+ let image_cache_receiver =
+ ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_image_cache_receiver);
LayoutTask {
id: id,
@@ -354,7 +352,7 @@ impl LayoutTask {
font_cache_task: font_cache_task,
first_reflow: Cell::new(true),
image_cache_receiver: image_cache_receiver,
- image_cache_sender: ImageCacheChan(image_cache_sender),
+ image_cache_sender: ImageCacheChan(ipc_image_cache_sender),
canvas_layers_receiver: canvas_layers_receiver,
canvas_layers_sender: canvas_layers_sender,
rw_data: Arc::new(Mutex::new(