Rename RenderChan -> PaintChan

This commit is contained in:
Tetsuharu OHZEKI 2014-12-08 03:58:58 +09:00
parent 9b6faaf7f0
commit 7ff790d941
7 changed files with 38 additions and 38 deletions

View file

@ -29,7 +29,7 @@ use geom::point::{Point2D, TypedPoint2D};
use geom::rect::{Rect, TypedRect}; use geom::rect::{Rect, TypedRect};
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use geom::scale_factor::ScaleFactor; use geom::scale_factor::ScaleFactor;
use gfx::paint_task::{RenderChan, RenderMsg, PaintRequest, UnusedBufferMsg}; use gfx::paint_task::{PaintChan, RenderMsg, PaintRequest, UnusedBufferMsg};
use layers::geometry::{DevicePixel, LayerPixel}; use layers::geometry::{DevicePixel, LayerPixel};
use layers::layers::{BufferRequest, Layer, LayerBufferSet}; use layers::layers::{BufferRequest, Layer, LayerBufferSet};
use layers::rendergl; use layers::rendergl;
@ -837,22 +837,22 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn convert_buffer_requests_to_pipeline_requests_map(&self, fn convert_buffer_requests_to_pipeline_requests_map(&self,
requests: Vec<(Rc<Layer<CompositorData>>, requests: Vec<(Rc<Layer<CompositorData>>,
Vec<BufferRequest>)>) -> Vec<BufferRequest>)>) ->
HashMap<PipelineId, (RenderChan, HashMap<PipelineId, (PaintChan,
Vec<PaintRequest>)> { Vec<PaintRequest>)> {
let scale = self.device_pixels_per_page_px(); let scale = self.device_pixels_per_page_px();
let mut results: let mut results:
HashMap<PipelineId, (RenderChan, Vec<PaintRequest>)> = HashMap::new(); HashMap<PipelineId, (PaintChan, Vec<PaintRequest>)> = HashMap::new();
for (layer, mut layer_requests) in requests.into_iter() { for (layer, mut layer_requests) in requests.into_iter() {
let &(_, ref mut vec) = let &(_, ref mut vec) =
match results.entry(layer.extra_data.borrow().pipeline.id) { match results.entry(layer.extra_data.borrow().pipeline.id) {
Occupied(mut entry) => { Occupied(mut entry) => {
*entry.get_mut() = *entry.get_mut() =
(layer.extra_data.borrow().pipeline.render_chan.clone(), vec!()); (layer.extra_data.borrow().pipeline.paint_chan.clone(), vec!());
entry.into_mut() entry.into_mut()
} }
Vacant(entry) => { Vacant(entry) => {
entry.set((layer.extra_data.borrow().pipeline.render_chan.clone(), vec!())) entry.set((layer.extra_data.borrow().pipeline.paint_chan.clone(), vec!()))
} }
}; };
@ -879,7 +879,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let unused_buffers = self.scene.collect_unused_buffers(); let unused_buffers = self.scene.collect_unused_buffers();
if unused_buffers.len() != 0 { if unused_buffers.len() != 0 {
let message = UnusedBufferMsg(unused_buffers); let message = UnusedBufferMsg(unused_buffers);
let _ = pipeline.render_chan.send_opt(message); let _ = pipeline.paint_chan.send_opt(message);
} }
}, },
None => {} None => {}

View file

@ -194,7 +194,7 @@ impl CompositorLayer for Layer<CompositorData> {
epoch, epoch,
self.extra_data.borrow().pipeline.id); self.extra_data.borrow().pipeline.id);
let msg = UnusedBufferMsg(new_buffers.buffers); let msg = UnusedBufferMsg(new_buffers.buffers);
let _ = self.extra_data.borrow().pipeline.render_chan.send_opt(msg); let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg);
return false; return false;
} }
@ -206,7 +206,7 @@ impl CompositorLayer for Layer<CompositorData> {
let unused_buffers = self.collect_unused_buffers(); let unused_buffers = self.collect_unused_buffers();
if !unused_buffers.is_empty() { // send back unused buffers if !unused_buffers.is_empty() { // send back unused buffers
let msg = UnusedBufferMsg(unused_buffers); let msg = UnusedBufferMsg(unused_buffers);
let _ = self.extra_data.borrow().pipeline.render_chan.send_opt(msg); let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(msg);
} }
} }
@ -224,7 +224,7 @@ impl CompositorLayer for Layer<CompositorData> {
buffer.mark_wont_leak() buffer.mark_wont_leak()
} }
let _ = self.extra_data.borrow().pipeline.render_chan.send_opt(UnusedBufferMsg(buffers)); let _ = self.extra_data.borrow().pipeline.paint_chan.send_opt(UnusedBufferMsg(buffers));
} }
} }

View file

@ -506,7 +506,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn force_pipeline_exit(old_pipeline: &Rc<Pipeline>) { fn force_pipeline_exit(old_pipeline: &Rc<Pipeline>) {
let ScriptControlChan(ref old_script) = old_pipeline.script_chan; let ScriptControlChan(ref old_script) = old_pipeline.script_chan;
let _ = old_script.send_opt(ExitPipelineMsg(old_pipeline.id)); let _ = old_script.send_opt(ExitPipelineMsg(old_pipeline.id));
let _ = old_pipeline.render_chan.send_opt(paint_task::ExitMsg(None)); let _ = old_pipeline.paint_chan.send_opt(paint_task::ExitMsg(None));
let LayoutControlChan(ref old_layout) = old_pipeline.layout_chan; let LayoutControlChan(ref old_layout) = old_pipeline.layout_chan;
let _ = old_layout.send_opt(ExitNowMsg); let _ = old_layout.send_opt(ExitNowMsg);
} }

View file

@ -9,7 +9,7 @@ use script_traits::{AttachLayoutMsg, LoadMsg, NewLayoutInfo, ExitPipelineMsg};
use devtools_traits::DevtoolsControlChan; use devtools_traits::DevtoolsControlChan;
use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked}; use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked};
use gfx::paint_task::{RenderChan, PaintTask}; use gfx::paint_task::{PaintChan, PaintTask};
use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId}; use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::{LoadData, WindowSizeData}; use servo_msg::constellation_msg::{LoadData, WindowSizeData};
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
@ -25,7 +25,7 @@ pub struct Pipeline {
pub subpage_id: Option<SubpageId>, pub subpage_id: Option<SubpageId>,
pub script_chan: ScriptControlChan, pub script_chan: ScriptControlChan,
pub layout_chan: LayoutControlChan, pub layout_chan: LayoutControlChan,
pub render_chan: RenderChan, pub paint_chan: PaintChan,
pub layout_shutdown_port: Receiver<()>, pub layout_shutdown_port: Receiver<()>,
pub render_shutdown_port: Receiver<()>, pub render_shutdown_port: Receiver<()>,
/// The most recently loaded page /// The most recently loaded page
@ -37,7 +37,7 @@ pub struct Pipeline {
pub struct CompositionPipeline { pub struct CompositionPipeline {
pub id: PipelineId, pub id: PipelineId,
pub script_chan: ScriptControlChan, pub script_chan: ScriptControlChan,
pub render_chan: RenderChan, pub paint_chan: PaintChan,
} }
impl Pipeline { impl Pipeline {
@ -60,7 +60,7 @@ impl Pipeline {
load_data: LoadData) load_data: LoadData)
-> Pipeline { -> Pipeline {
let layout_pair = ScriptTaskFactory::create_layout_channel(None::<&mut STF>); let layout_pair = ScriptTaskFactory::create_layout_channel(None::<&mut STF>);
let (render_port, render_chan) = RenderChan::new(); let (render_port, paint_chan) = PaintChan::new();
let (render_shutdown_chan, render_shutdown_port) = channel(); let (render_shutdown_chan, render_shutdown_port) = channel();
let (layout_shutdown_chan, layout_shutdown_port) = channel(); let (layout_shutdown_chan, layout_shutdown_port) = channel();
let (pipeline_chan, pipeline_port) = channel(); let (pipeline_chan, pipeline_port) = channel();
@ -118,7 +118,7 @@ impl Pipeline {
constellation_chan, constellation_chan,
failure, failure,
script_chan.clone(), script_chan.clone(),
render_chan.clone(), paint_chan.clone(),
resource_task, resource_task,
image_cache_task, image_cache_task,
font_cache_task, font_cache_task,
@ -129,7 +129,7 @@ impl Pipeline {
subpage_id, subpage_id,
script_chan, script_chan,
LayoutControlChan(pipeline_chan), LayoutControlChan(pipeline_chan),
render_chan, paint_chan,
layout_shutdown_port, layout_shutdown_port,
render_shutdown_port, render_shutdown_port,
load_data) load_data)
@ -139,7 +139,7 @@ impl Pipeline {
subpage_id: Option<SubpageId>, subpage_id: Option<SubpageId>,
script_chan: ScriptControlChan, script_chan: ScriptControlChan,
layout_chan: LayoutControlChan, layout_chan: LayoutControlChan,
render_chan: RenderChan, paint_chan: PaintChan,
layout_shutdown_port: Receiver<()>, layout_shutdown_port: Receiver<()>,
render_shutdown_port: Receiver<()>, render_shutdown_port: Receiver<()>,
load_data: LoadData) load_data: LoadData)
@ -149,7 +149,7 @@ impl Pipeline {
subpage_id: subpage_id, subpage_id: subpage_id,
script_chan: script_chan, script_chan: script_chan,
layout_chan: layout_chan, layout_chan: layout_chan,
render_chan: render_chan, paint_chan: paint_chan,
layout_shutdown_port: layout_shutdown_port, layout_shutdown_port: layout_shutdown_port,
render_shutdown_port: render_shutdown_port, render_shutdown_port: render_shutdown_port,
load_data: load_data, load_data: load_data,
@ -162,12 +162,12 @@ impl Pipeline {
} }
pub fn grant_paint_permission(&self) { pub fn grant_paint_permission(&self) {
let _ = self.render_chan.send_opt(PaintPermissionGranted); let _ = self.paint_chan.send_opt(PaintPermissionGranted);
} }
pub fn revoke_paint_permission(&self) { pub fn revoke_paint_permission(&self) {
debug!("pipeline revoking render channel paint permission"); debug!("pipeline revoking render channel paint permission");
let _ = self.render_chan.send_opt(PaintPermissionRevoked); let _ = self.paint_chan.send_opt(PaintPermissionRevoked);
} }
pub fn exit(&self) { pub fn exit(&self) {
@ -188,7 +188,7 @@ impl Pipeline {
CompositionPipeline { CompositionPipeline {
id: self.id.clone(), id: self.id.clone(),
script_chan: self.script_chan.clone(), script_chan: self.script_chan.clone(),
render_chan: self.render_chan.clone(), paint_chan: self.paint_chan.clone(),
} }
} }
} }

View file

@ -77,21 +77,21 @@ pub enum Msg {
} }
#[deriving(Clone)] #[deriving(Clone)]
pub struct RenderChan(Sender<Msg>); pub struct PaintChan(Sender<Msg>);
impl RenderChan { impl PaintChan {
pub fn new() -> (Receiver<Msg>, RenderChan) { pub fn new() -> (Receiver<Msg>, PaintChan) {
let (chan, port) = channel(); let (chan, port) = channel();
(port, RenderChan(chan)) (port, PaintChan(chan))
} }
pub fn send(&self, msg: Msg) { pub fn send(&self, msg: Msg) {
let &RenderChan(ref chan) = self; let &PaintChan(ref chan) = self;
assert!(chan.send_opt(msg).is_ok(), "RenderChan.send: render port closed") assert!(chan.send_opt(msg).is_ok(), "PaintChan.send: render port closed")
} }
pub fn send_opt(&self, msg: Msg) -> Result<(), Msg> { pub fn send_opt(&self, msg: Msg) -> Result<(), Msg> {
let &RenderChan(ref chan) = self; let &PaintChan(ref chan) = self;
chan.send_opt(msg) chan.send_opt(msg)
} }
} }

View file

@ -28,7 +28,7 @@ use geom::scale_factor::ScaleFactor;
use gfx::color; use gfx::color;
use gfx::display_list::{DisplayList, OpaqueNode, StackingContext}; use gfx::display_list::{DisplayList, OpaqueNode, StackingContext};
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::{mod, RenderInitMsg, RenderChan, PaintLayer}; use gfx::paint_task::{mod, RenderInitMsg, PaintChan, PaintLayer};
use layout_traits; use layout_traits;
use layout_traits::{LayoutControlMsg, LayoutTaskFactory}; use layout_traits::{LayoutControlMsg, LayoutTaskFactory};
use log; use log;
@ -119,7 +119,7 @@ pub struct LayoutTask {
pub script_chan: ScriptControlChan, pub script_chan: ScriptControlChan,
/// The channel on which messages can be sent to the painting task. /// The channel on which messages can be sent to the painting task.
pub render_chan: RenderChan, pub paint_chan: PaintChan,
/// The channel on which messages can be sent to the time profiler. /// The channel on which messages can be sent to the time profiler.
pub time_profiler_chan: TimeProfilerChan, pub time_profiler_chan: TimeProfilerChan,
@ -173,7 +173,7 @@ impl LayoutTaskFactory for LayoutTask {
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
failure_msg: Failure, failure_msg: Failure,
script_chan: ScriptControlChan, script_chan: ScriptControlChan,
render_chan: RenderChan, paint_chan: PaintChan,
resource_task: ResourceTask, resource_task: ResourceTask,
img_cache_task: ImageCacheTask, img_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,
@ -191,7 +191,7 @@ impl LayoutTaskFactory for LayoutTask {
pipeline_port, pipeline_port,
constellation_chan, constellation_chan,
script_chan, script_chan,
render_chan, paint_chan,
resource_task, resource_task,
img_cache_task, img_cache_task,
font_cache_task, font_cache_task,
@ -240,7 +240,7 @@ impl LayoutTask {
pipeline_port: Receiver<LayoutControlMsg>, pipeline_port: Receiver<LayoutControlMsg>,
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
script_chan: ScriptControlChan, script_chan: ScriptControlChan,
render_chan: RenderChan, paint_chan: PaintChan,
resource_task: ResourceTask, resource_task: ResourceTask,
image_cache_task: ImageCacheTask, image_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,
@ -264,7 +264,7 @@ impl LayoutTask {
chan: chan, chan: chan,
constellation_chan: constellation_chan, constellation_chan: constellation_chan,
script_chan: script_chan, script_chan: script_chan,
render_chan: render_chan, paint_chan: paint_chan,
time_profiler_chan: time_profiler_chan, time_profiler_chan: time_profiler_chan,
resource_task: resource_task, resource_task: resource_task,
image_cache_task: image_cache_task.clone(), image_cache_task: image_cache_task.clone(),
@ -463,7 +463,7 @@ impl LayoutTask {
LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data); LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data);
} }
self.render_chan.send(paint_task::ExitMsg(Some(response_chan))); self.paint_chan.send(paint_task::ExitMsg(Some(response_chan)));
response_port.recv() response_port.recv()
} }
@ -690,7 +690,7 @@ impl LayoutTask {
debug!("Layout done!"); debug!("Layout done!");
self.render_chan.send(RenderInitMsg(stacking_context)); self.paint_chan.send(RenderInitMsg(stacking_context));
}); });
} }

View file

@ -20,7 +20,7 @@ extern crate "util" as servo_util;
// that these modules won't have to depend on layout. // that these modules won't have to depend on layout.
use gfx::font_cache_task::FontCacheTask; use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::RenderChan; use gfx::paint_task::PaintChan;
use servo_msg::constellation_msg::{ConstellationChan, PipelineId}; use servo_msg::constellation_msg::{ConstellationChan, PipelineId};
use servo_msg::constellation_msg::Failure; use servo_msg::constellation_msg::Failure;
use servo_net::image_cache_task::ImageCacheTask; use servo_net::image_cache_task::ImageCacheTask;
@ -48,7 +48,7 @@ pub trait LayoutTaskFactory {
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
failure_msg: Failure, failure_msg: Failure,
script_chan: ScriptControlChan, script_chan: ScriptControlChan,
render_chan: RenderChan, paint_chan: PaintChan,
resource_task: ResourceTask, resource_task: ResourceTask,
img_cache_task: ImageCacheTask, img_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask, font_cache_task: FontCacheTask,