mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
gfx: Split the paint messages into layout and chrome messages, and make
the layout messages serializable.
This commit is contained in:
parent
f041e1aa60
commit
3be5bbbaa3
6 changed files with 97 additions and 75 deletions
|
@ -37,8 +37,7 @@ use gfx_traits::color;
|
|||
use gfx::display_list::{ClippingRegion, DisplayItemMetadata, DisplayList, OpaqueNode};
|
||||
use gfx::display_list::StackingContext;
|
||||
use gfx::font_cache_task::FontCacheTask;
|
||||
use gfx::paint_task::Msg as PaintMsg;
|
||||
use gfx::paint_task::{PaintChan, PaintLayer};
|
||||
use gfx::paint_task::{LayoutToPaintMsg, PaintLayer};
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layout_traits::LayoutTaskFactory;
|
||||
|
@ -188,7 +187,7 @@ pub struct LayoutTask {
|
|||
pub script_chan: ScriptControlChan,
|
||||
|
||||
/// The channel on which messages can be sent to the painting task.
|
||||
pub paint_chan: PaintChan,
|
||||
pub paint_chan: Sender<LayoutToPaintMsg>,
|
||||
|
||||
/// The channel on which messages can be sent to the time profiler.
|
||||
pub time_profiler_chan: time::ProfilerChan,
|
||||
|
@ -228,7 +227,7 @@ impl LayoutTaskFactory for LayoutTask {
|
|||
constellation_chan: ConstellationChan,
|
||||
failure_msg: Failure,
|
||||
script_chan: ScriptControlChan,
|
||||
paint_chan: PaintChan,
|
||||
paint_chan: Sender<LayoutToPaintMsg>,
|
||||
image_cache_task: ImageCacheTask,
|
||||
font_cache_task: FontCacheTask,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
|
@ -318,7 +317,7 @@ impl LayoutTask {
|
|||
pipeline_port: IpcReceiver<LayoutControlMsg>,
|
||||
constellation_chan: ConstellationChan,
|
||||
script_chan: ScriptControlChan,
|
||||
paint_chan: PaintChan,
|
||||
paint_chan: Sender<LayoutToPaintMsg>,
|
||||
image_cache_task: ImageCacheTask,
|
||||
font_cache_task: FontCacheTask,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
|
@ -647,7 +646,9 @@ impl LayoutTask {
|
|||
info.constellation_chan,
|
||||
info.failure,
|
||||
ScriptControlChan(info.script_chan.clone()),
|
||||
*info.paint_chan.downcast::<PaintChan>().unwrap(),
|
||||
*info.paint_chan
|
||||
.downcast::<Sender<LayoutToPaintMsg>>()
|
||||
.unwrap(),
|
||||
self.image_cache_task.clone(),
|
||||
self.font_cache_task.clone(),
|
||||
self.time_profiler_chan.clone(),
|
||||
|
@ -689,7 +690,7 @@ impl LayoutTask {
|
|||
fn exit_now<'a>(&'a self,
|
||||
possibly_locked_rw_data: &mut Option<MutexGuard<'a, LayoutTaskData>>,
|
||||
exit_type: PipelineExitType) {
|
||||
let (response_chan, response_port) = channel();
|
||||
let (response_chan, response_port) = ipc::channel().unwrap();
|
||||
|
||||
{
|
||||
let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
|
||||
|
@ -699,7 +700,7 @@ impl LayoutTask {
|
|||
LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data);
|
||||
}
|
||||
|
||||
self.paint_chan.send(PaintMsg::Exit(Some(response_chan), exit_type));
|
||||
self.paint_chan.send(LayoutToPaintMsg::Exit(Some(response_chan), exit_type)).unwrap();
|
||||
response_port.recv().unwrap()
|
||||
}
|
||||
|
||||
|
@ -1071,7 +1072,9 @@ impl LayoutTask {
|
|||
debug!("Layout done!");
|
||||
|
||||
rw_data.epoch.next();
|
||||
self.paint_chan.send(PaintMsg::PaintInit(rw_data.epoch, stacking_context));
|
||||
self.paint_chan
|
||||
.send(LayoutToPaintMsg::PaintInit(rw_data.epoch, stacking_context))
|
||||
.unwrap();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1175,7 +1178,7 @@ impl LayoutTask {
|
|||
// Send new canvas renderers to the paint task
|
||||
while let Ok((layer_id, renderer)) = self.canvas_layers_receiver.try_recv() {
|
||||
// Just send if there's an actual renderer
|
||||
self.paint_chan.send(PaintMsg::CanvasLayer(layer_id, renderer));
|
||||
self.paint_chan.send(LayoutToPaintMsg::CanvasLayer(layer_id, renderer)).unwrap();
|
||||
}
|
||||
|
||||
// Perform post-style recalculation layout passes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue