Rename Compositor messages SetIds and Paint

These names no longer reflect what the messages do, so rename them to
SetFrameTree and AssignPaintedBuffers.
This commit is contained in:
Martin Robinson 2015-01-06 07:23:26 -08:00
parent cf616b90a2
commit ad751e4926
6 changed files with 48 additions and 48 deletions

View file

@ -113,8 +113,8 @@ pub struct IOCompositor<Window: WindowMethods> {
/// many times for a single page. /// many times for a single page.
got_load_complete_message: bool, got_load_complete_message: bool,
/// Whether we have gotten a `SetIds` message. /// Whether we have received a `SetFrameTree` message.
got_set_ids_message: bool, got_set_frame_tree_message: bool,
/// The channel on which messages can be sent to the constellation. /// The channel on which messages can be sent to the constellation.
constellation_chan: ConstellationChan, constellation_chan: ConstellationChan,
@ -195,7 +195,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
ready_states: HashMap::new(), ready_states: HashMap::new(),
paint_states: HashMap::new(), paint_states: HashMap::new(),
got_load_complete_message: false, got_load_complete_message: false,
got_set_ids_message: false, got_set_frame_tree_message: false,
constellation_chan: constellation_chan, constellation_chan: constellation_chan,
time_profiler_chan: time_profiler_chan, time_profiler_chan: time_profiler_chan,
memory_profiler_chan: memory_profiler_chan, memory_profiler_chan: memory_profiler_chan,
@ -268,7 +268,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.remove_outstanding_paint_msg(); self.remove_outstanding_paint_msg();
} }
(Msg::SetIds(frame_tree, response_chan, new_constellation_chan), (Msg::SetFrameTree(frame_tree, response_chan, new_constellation_chan),
ShutdownState::NotShuttingDown) => { ShutdownState::NotShuttingDown) => {
self.set_frame_tree(&frame_tree, self.set_frame_tree(&frame_tree,
response_chan, response_chan,
@ -300,9 +300,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.set_layer_origin(pipeline_id, layer_id, origin); self.set_layer_origin(pipeline_id, layer_id, origin);
} }
(Msg::Paint(pipeline_id, epoch, replies), ShutdownState::NotShuttingDown) => { (Msg::AssignPaintedBuffers(pipeline_id, epoch, replies), ShutdownState::NotShuttingDown) => {
for (layer_id, new_layer_buffer_set) in replies.into_iter() { for (layer_id, new_layer_buffer_set) in replies.into_iter() {
self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch); self.assign_painted_buffers(pipeline_id, layer_id, new_layer_buffer_set, epoch);
} }
self.remove_outstanding_paint_msg(); self.remove_outstanding_paint_msg();
} }
@ -463,7 +463,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.constellation_chan = new_constellation_chan; self.constellation_chan = new_constellation_chan;
self.send_window_size(); self.send_window_size();
self.got_set_ids_message = true; self.got_set_frame_tree_message = true;
self.composite_if_necessary(); self.composite_if_necessary();
} }
@ -653,13 +653,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.send_buffer_requests_for_all_layers(); self.send_buffer_requests_for_all_layers();
} }
fn paint(&mut self, fn assign_painted_buffers(&mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
layer_id: LayerId, layer_id: LayerId,
new_layer_buffer_set: Box<LayerBufferSet>, new_layer_buffer_set: Box<LayerBufferSet>,
epoch: Epoch) { epoch: Epoch) {
match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) { match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) {
Some(layer) => self.paint_to_layer(layer, new_layer_buffer_set, epoch), Some(layer) => self.assign_painted_buffers_to_layer(layer, new_layer_buffer_set, epoch),
None => { None => {
match self.paint_channels.entry(pipeline_id) { match self.paint_channels.entry(pipeline_id) {
Occupied(entry) => { Occupied(entry) => {
@ -672,10 +672,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
} }
} }
fn paint_to_layer(&mut self, fn assign_painted_buffers_to_layer(&mut self,
layer: Rc<Layer<CompositorData>>, layer: Rc<Layer<CompositorData>>,
new_layer_buffer_set: Box<LayerBufferSet>, new_layer_buffer_set: Box<LayerBufferSet>,
epoch: Epoch) { epoch: Epoch) {
debug!("compositor received new frame at size {}x{}", debug!("compositor received new frame at size {}x{}",
self.window_size.width.get(), self.window_size.width.get(),
self.window_size.height.get()); self.window_size.height.get());
@ -1037,7 +1037,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
return false; return false;
} }
if !self.got_set_ids_message { if !self.got_set_frame_tree_message {
return false; return false;
} }
@ -1294,12 +1294,12 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
fn repaint_synchronously(&mut self) { fn repaint_synchronously(&mut self) {
while self.shutdown_state != ShutdownState::ShuttingDown { while self.shutdown_state != ShutdownState::ShuttingDown {
let msg = self.port.recv_compositor_msg(); let msg = self.port.recv_compositor_msg();
let is_paint = match msg { let received_new_buffers = match msg {
Msg::Paint(..) => true, Msg::AssignPaintedBuffers(..) => true,
_ => false, _ => false,
}; };
let keep_going = self.handle_browser_message(msg); let keep_going = self.handle_browser_message(msg);
if is_paint { if received_new_buffers {
self.composite(); self.composite();
break break
} }
@ -1317,7 +1317,7 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
} }
// Drain compositor port, sometimes messages contain channels that are blocking // Drain compositor port, sometimes messages contain channels that are blocking
// another task from finishing (i.e. SetIds) // another task from finishing (i.e. SetFrameTree).
while self.port.try_recv_compositor_msg().is_some() {} while self.port.try_recv_compositor_msg().is_some() {}
// Tell the profiler, memory profiler, and scrolling timer to shut down. // Tell the profiler, memory profiler, and scrolling timer to shut down.

View file

@ -129,11 +129,11 @@ impl PaintListener for Box<CompositorProxy+'static+Send> {
port.recv() port.recv()
} }
fn paint(&mut self, fn assign_painted_buffers(&mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
epoch: Epoch, epoch: Epoch,
replies: Vec<(LayerId, Box<LayerBufferSet>)>) { replies: Vec<(LayerId, Box<LayerBufferSet>)>) {
self.send(Msg::Paint(pipeline_id, epoch, replies)); self.send(Msg::AssignPaintedBuffers(pipeline_id, epoch, replies));
} }
fn initialize_layers_for_pipeline(&mut self, fn initialize_layers_for_pipeline(&mut self,
@ -170,8 +170,8 @@ pub enum Msg {
Exit(Sender<()>), Exit(Sender<()>),
/// Informs the compositor that the constellation has completed shutdown. /// Informs the compositor that the constellation has completed shutdown.
/// Required because the constellation can have pending calls to make (e.g. SetIds) /// Required because the constellation can have pending calls to make
/// at the time that we send it an ExitMsg. /// (e.g. SetFrameTree) at the time that we send it an ExitMsg.
ShutdownComplete, ShutdownComplete,
/// Requests the compositor's graphics metadata. Graphics metadata is what the painter needs /// Requests the compositor's graphics metadata. Graphics metadata is what the painter needs
@ -191,8 +191,8 @@ pub enum Msg {
SetLayerOrigin(PipelineId, LayerId, Point2D<f32>), SetLayerOrigin(PipelineId, LayerId, Point2D<f32>),
/// Scroll a page in a window /// Scroll a page in a window
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>), ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>),
/// Requests that the compositor paint the given layer buffer set for the given page size. /// Requests that the compositor assign the painted buffers to the given layers.
Paint(PipelineId, Epoch, Vec<(LayerId, Box<LayerBufferSet>)>), AssignPaintedBuffers(PipelineId, Epoch, Vec<(LayerId, Box<LayerBufferSet>)>),
/// Alerts the compositor to the current status of page loading. /// Alerts the compositor to the current status of page loading.
ChangeReadyState(PipelineId, ReadyState), ChangeReadyState(PipelineId, ReadyState),
/// Alerts the compositor to the current status of painting. /// Alerts the compositor to the current status of painting.
@ -203,8 +203,8 @@ pub enum Msg {
ChangePageLoadData(FrameId, LoadData), ChangePageLoadData(FrameId, LoadData),
/// Alerts the compositor that a `PaintMsg` has been discarded. /// Alerts the compositor that a `PaintMsg` has been discarded.
PaintMsgDiscarded, PaintMsgDiscarded,
/// Sets the channel to the current layout and paint tasks, along with their ID. /// Replaces the current frame tree, typically called during main frame navigation.
SetIds(SendableFrameTree, Sender<()>, ConstellationChan), SetFrameTree(SendableFrameTree, Sender<()>, ConstellationChan),
/// Sends an updated version of the frame tree. /// Sends an updated version of the frame tree.
FrameTreeUpdate(FrameTreeDiff, Sender<()>), FrameTreeUpdate(FrameTreeDiff, Sender<()>),
/// The load of a page has completed. /// The load of a page has completed.
@ -230,14 +230,14 @@ impl Show for Msg {
Msg::CreateOrUpdateDescendantLayer(..) => write!(f, "CreateOrUpdateDescendantLayer"), Msg::CreateOrUpdateDescendantLayer(..) => write!(f, "CreateOrUpdateDescendantLayer"),
Msg::SetLayerOrigin(..) => write!(f, "SetLayerOrigin"), Msg::SetLayerOrigin(..) => write!(f, "SetLayerOrigin"),
Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"), Msg::ScrollFragmentPoint(..) => write!(f, "ScrollFragmentPoint"),
Msg::Paint(..) => write!(f, "Paint"), Msg::AssignPaintedBuffers(..) => write!(f, "AssignPaintedBuffers"),
Msg::ChangeReadyState(..) => write!(f, "ChangeReadyState"), Msg::ChangeReadyState(..) => write!(f, "ChangeReadyState"),
Msg::ChangePaintState(..) => write!(f, "ChangePaintState"), Msg::ChangePaintState(..) => write!(f, "ChangePaintState"),
Msg::ChangePageTitle(..) => write!(f, "ChangePageTitle"), Msg::ChangePageTitle(..) => write!(f, "ChangePageTitle"),
Msg::ChangePageLoadData(..) => write!(f, "ChangePageLoadData"), Msg::ChangePageLoadData(..) => write!(f, "ChangePageLoadData"),
Msg::PaintMsgDiscarded(..) => write!(f, "PaintMsgDiscarded"), Msg::PaintMsgDiscarded(..) => write!(f, "PaintMsgDiscarded"),
Msg::FrameTreeUpdate(..) => write!(f, "FrameTreeUpdate"), Msg::FrameTreeUpdate(..) => write!(f, "FrameTreeUpdate"),
Msg::SetIds(..) => write!(f, "SetIds"), Msg::SetFrameTree(..) => write!(f, "SetFrameTree"),
Msg::LoadComplete => write!(f, "LoadComplete"), Msg::LoadComplete => write!(f, "LoadComplete"),
Msg::ScrollTimeout(..) => write!(f, "ScrollTimeout"), Msg::ScrollTimeout(..) => write!(f, "ScrollTimeout"),
Msg::KeyEvent(..) => write!(f, "KeyEvent"), Msg::KeyEvent(..) => write!(f, "KeyEvent"),

View file

@ -1019,10 +1019,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn set_ids(&mut self, frame_tree: &Rc<FrameTree>) { fn set_ids(&mut self, frame_tree: &Rc<FrameTree>) {
let (chan, port) = channel(); let (chan, port) = channel();
debug!("Constellation sending SetIds"); debug!("Constellation sending SetFrameTree");
self.compositor_proxy.send(CompositorMsg::SetIds(frame_tree.to_sendable(), self.compositor_proxy.send(CompositorMsg::SetFrameTree(frame_tree.to_sendable(),
chan, chan,
self.chan.clone())); self.chan.clone()));
match port.recv_opt() { match port.recv_opt() {
Ok(()) => { Ok(()) => {
let mut iter = frame_tree.iter(); let mut iter = frame_tree.iter();

View file

@ -86,7 +86,7 @@ impl CompositorEventListener for NullCompositor {
chan.send(None); chan.send(None);
} }
Msg::SetIds(_, response_chan, _) => { Msg::SetFrameTree(_, response_chan, _) => {
response_chan.send(()); response_chan.send(());
} }
@ -96,12 +96,12 @@ impl CompositorEventListener for NullCompositor {
// Explicitly list ignored messages so that when we add a new one, // Explicitly list ignored messages so that when we add a new one,
// we'll notice and think about whether it needs a response, like // we'll notice and think about whether it needs a response, like
// SetIds. // SetFrameTree.
Msg::CreateOrUpdateRootLayer(..) | Msg::CreateOrUpdateRootLayer(..) |
Msg::CreateOrUpdateDescendantLayer(..) | Msg::CreateOrUpdateDescendantLayer(..) |
Msg::SetLayerOrigin(..) | Msg::SetLayerOrigin(..) |
Msg::Paint(..) | Msg::AssignPaintedBuffers(..) |
Msg::ChangeReadyState(..) | Msg::ChangeReadyState(..) |
Msg::ChangePaintState(..) | Msg::ChangePaintState(..) |
Msg::ScrollFragmentPoint(..) | Msg::ScrollFragmentPoint(..) |

View file

@ -278,7 +278,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
} }
debug!("PaintTask: returning surfaces"); debug!("PaintTask: returning surfaces");
self.compositor.paint(self.id, self.epoch, replies); self.compositor.assign_painted_buffers(self.id, self.epoch, replies);
} }
Msg::UnusedBuffer(unused_buffers) => { Msg::UnusedBuffer(unused_buffers) => {
debug!("PaintTask: Received {} unused buffers", unused_buffers.len()); debug!("PaintTask: Received {} unused buffers", unused_buffers.len());

View file

@ -94,11 +94,11 @@ pub trait PaintListener for Sized? {
metadata: Vec<LayerMetadata>, metadata: Vec<LayerMetadata>,
epoch: Epoch); epoch: Epoch);
/// Sends new tiles for the given layer to the compositor. /// Sends new buffers for the given layers to the compositor.
fn paint(&mut self, fn assign_painted_buffers(&mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
epoch: Epoch, epoch: Epoch,
replies: Vec<(LayerId, Box<LayerBufferSet>)>); replies: Vec<(LayerId, Box<LayerBufferSet>)>);
fn paint_msg_discarded(&mut self); fn paint_msg_discarded(&mut self);
fn set_paint_state(&mut self, PipelineId, PaintState); fn set_paint_state(&mut self, PipelineId, PaintState);