compositing: Use an OptionalIpcSender for communication between the

layout and paint tasks.
This commit is contained in:
Patrick Walton 2015-07-27 14:06:03 -07:00
parent 3be5bbbaa3
commit 1ff7a51f0a
4 changed files with 26 additions and 9 deletions

View file

@ -29,7 +29,9 @@ use std::mem;
use std::sync::mpsc::{Receiver, Sender, channel};
use std::thread;
use url::Url;
use util;
use util::geometry::{PagePx, ViewportPx};
use util::ipc::OptionalIpcSender;
use util::opts;
/// A uniquely-identifiable pipeline of script task, layout task, and paint task.
@ -83,7 +85,7 @@ impl Pipeline {
device_pixel_ratio: ScaleFactor<ViewportPx, DevicePixel, f32>)
-> (Pipeline, PipelineContent)
where LTF: LayoutTaskFactory, STF:ScriptTaskFactory {
let (layout_to_paint_chan, layout_to_paint_port) = channel();
let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel();
let (chrome_to_paint_chan, chrome_to_paint_port) = channel();
let (paint_shutdown_chan, paint_shutdown_port) = channel();
let (layout_shutdown_chan, layout_shutdown_port) = channel();
@ -206,12 +208,12 @@ impl Pipeline {
}
pub fn grant_paint_permission(&self) {
drop(self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionGranted));
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionGranted);
}
pub fn revoke_paint_permission(&self) {
debug!("pipeline revoking paint channel paint permission");
drop(self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionRevoked));
let _ = self.chrome_to_paint_chan.send(ChromeToPaintMsg::PaintPermissionRevoked);
}
pub fn exit(&self, exit_type: PipelineExitType) {
@ -300,7 +302,7 @@ pub struct PipelineContent {
load_data: LoadData,
failure: Failure,
script_port: Option<Receiver<ConstellationControlMsg>>,
layout_to_paint_chan: Sender<LayoutToPaintMsg>,
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
chrome_to_paint_chan: Sender<ChromeToPaintMsg>,
layout_to_paint_port: Option<Receiver<LayoutToPaintMsg>>,
chrome_to_paint_port: Option<Receiver<ChromeToPaintMsg>>,