Rename RenderState -> PaintState

This commit is contained in:
Tetsuharu OHZEKI 2014-12-08 13:28:13 +09:00
parent b5f73fb179
commit 806b6f09c9
8 changed files with 49 additions and 49 deletions

View file

@ -39,8 +39,8 @@ use png;
use gleam::gl::types::{GLint, GLsizei}; use gleam::gl::types::{GLint, GLsizei};
use gleam::gl; use gleam::gl;
use script_traits::{ViewportMsg, ScriptControlChan}; use script_traits::{ViewportMsg, ScriptControlChan};
use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdleRenderState, LayerId}; use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdlePaintState, LayerId};
use servo_msg::compositor_msg::{ReadyState, RenderingRenderState, RenderState, Scrollable}; use servo_msg::compositor_msg::{ReadyState, PaintingPaintState, PaintState, Scrollable};
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, LoadUrlMsg}; use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, LoadUrlMsg};
use servo_msg::constellation_msg::{NavigateMsg, LoadData, PipelineId, ResizedWindowMsg}; use servo_msg::constellation_msg::{NavigateMsg, LoadData, PipelineId, ResizedWindowMsg};
use servo_msg::constellation_msg::{WindowSizeData, KeyState, Key, KeyModifiers}; use servo_msg::constellation_msg::{WindowSizeData, KeyState, Key, KeyModifiers};
@ -112,8 +112,8 @@ pub struct IOCompositor<Window: WindowMethods> {
/// Current display/reflow status of each pipeline. /// Current display/reflow status of each pipeline.
ready_states: HashMap<PipelineId, ReadyState>, ready_states: HashMap<PipelineId, ReadyState>,
/// Current render status of each pipeline. /// Current paint status of each pipeline.
render_states: HashMap<PipelineId, RenderState>, render_states: HashMap<PipelineId, PaintState>,
/// Whether the page being rendered has loaded completely. /// Whether the page being rendered has loaded completely.
/// Differs from ReadyState because we can finish loading (ready) /// Differs from ReadyState because we can finish loading (ready)
@ -358,7 +358,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
} }
fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: PaintState) {
match self.render_states.entry(pipeline_id) { match self.render_states.entry(pipeline_id) {
Occupied(entry) => { Occupied(entry) => {
*entry.into_mut() = render_state; *entry.into_mut() = render_state;
@ -375,7 +375,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
if self.ready_states.len() == 0 { if self.ready_states.len() == 0 {
return false; return false;
} }
return self.render_states.values().all(|&value| value == IdleRenderState); return self.render_states.values().all(|&value| value == IdlePaintState);
} }
fn has_render_msg_tracking(&self) -> bool { fn has_render_msg_tracking(&self) -> bool {
@ -435,9 +435,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
frame_tree: &SendableFrameTree, frame_tree: &SendableFrameTree,
frame_rect: Option<TypedRect<PagePx, f32>>) frame_rect: Option<TypedRect<PagePx, f32>>)
-> Rc<Layer<CompositorData>> { -> Rc<Layer<CompositorData>> {
// Initialize the ReadyState and RenderState for this pipeline. // Initialize the ReadyState and PaintState for this pipeline.
self.ready_states.insert(frame_tree.pipeline.id, Blank); self.ready_states.insert(frame_tree.pipeline.id, Blank);
self.render_states.insert(frame_tree.pipeline.id, RenderingRenderState); self.render_states.insert(frame_tree.pipeline.id, PaintingPaintState);
let root_layer = create_root_layer_for_pipeline_and_rect(&frame_tree.pipeline, frame_rect); let root_layer = create_root_layer_for_pipeline_and_rect(&frame_tree.pipeline, frame_rect);
for kid in frame_tree.children.iter() { for kid in frame_tree.children.iter() {

View file

@ -18,7 +18,7 @@ use geom::size::Size2D;
use layers::platform::surface::{NativeCompositingGraphicsContext, NativeGraphicsMetadata}; use layers::platform::surface::{NativeCompositingGraphicsContext, NativeGraphicsMetadata};
use layers::layers::LayerBufferSet; use layers::layers::LayerBufferSet;
use servo_msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState}; use servo_msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState};
use servo_msg::compositor_msg::{PaintListener, RenderState, ScriptListener, ScrollPolicy}; use servo_msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy};
use servo_msg::constellation_msg::{ConstellationChan, PipelineId}; use servo_msg::constellation_msg::{ConstellationChan, PipelineId};
use servo_util::memory::MemoryProfilerChan; use servo_util::memory::MemoryProfilerChan;
use servo_util::time::TimeProfilerChan; use servo_util::time::TimeProfilerChan;
@ -146,8 +146,8 @@ impl PaintListener for Box<CompositorProxy+'static+Send> {
self.send(PaintMsgDiscarded); self.send(PaintMsgDiscarded);
} }
fn set_paint_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) { fn set_paint_state(&mut self, pipeline_id: PipelineId, paint_state: PaintState) {
self.send(ChangePaintState(pipeline_id, render_state)) self.send(ChangePaintState(pipeline_id, paint_state))
} }
} }
@ -182,8 +182,8 @@ pub enum Msg {
Paint(PipelineId, Epoch, Vec<(LayerId, Box<LayerBufferSet>)>), Paint(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 rendering. /// Alerts the compositor to the current status of painting.
ChangePaintState(PipelineId, RenderState), ChangePaintState(PipelineId, PaintState),
/// Alerts the compositor that the RenderMsg has been discarded. /// Alerts the compositor that the RenderMsg has been discarded.
PaintMsgDiscarded, PaintMsgDiscarded,
/// Sets the channel to the current layout and render tasks, along with their id /// Sets the channel to the current layout and render tasks, along with their id

View file

@ -12,7 +12,7 @@ use geom::size::TypedSize2D;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers}; use servo_msg::constellation_msg::{Key, KeyState, KeyModifiers};
use servo_msg::compositor_msg::{ReadyState, RenderState}; use servo_msg::compositor_msg::{ReadyState, PaintState};
use servo_util::geometry::ScreenPx; use servo_util::geometry::ScreenPx;
use std::fmt::{FormatError, Formatter, Show}; use std::fmt::{FormatError, Formatter, Show};
use std::rc::Rc; use std::rc::Rc;
@ -90,8 +90,8 @@ pub trait WindowMethods {
/// Sets the ready state of the current page. /// Sets the ready state of the current page.
fn set_ready_state(&self, ready_state: ReadyState); fn set_ready_state(&self, ready_state: ReadyState);
/// Sets the render state of the current page. /// Sets the paint state of the current page.
fn set_render_state(&self, render_state: RenderState); fn set_render_state(&self, paint_state: PaintState);
/// Returns the hidpi factor of the monitor. /// Returns the hidpi factor of the monitor.
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>; fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>;

View file

@ -21,8 +21,8 @@ use layers::platform::surface::{NativeSurface, NativeSurfaceMethods};
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers; use layers;
use native::task::NativeTaskBuilder; use native::task::NativeTaskBuilder;
use servo_msg::compositor_msg::{Epoch, IdleRenderState, LayerId}; use servo_msg::compositor_msg::{Epoch, IdlePaintState, LayerId};
use servo_msg::compositor_msg::{LayerMetadata, PaintListener, RenderingRenderState, ScrollPolicy}; use servo_msg::compositor_msg::{LayerMetadata, PaintListener, PaintingPaintState, ScrollPolicy};
use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineId}; use servo_msg::constellation_msg::{ConstellationChan, Failure, FailureMsg, PipelineId};
use servo_msg::constellation_msg::{RendererReadyMsg}; use servo_msg::constellation_msg::{RendererReadyMsg};
use servo_msg::platform::surface::NativeSurfaceAzureMethods; use servo_msg::platform::surface::NativeSurfaceAzureMethods;
@ -253,7 +253,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
} }
let mut replies = Vec::new(); let mut replies = Vec::new();
self.compositor.set_paint_state(self.id, RenderingRenderState); self.compositor.set_paint_state(self.id, PaintingPaintState);
for PaintRequest { buffer_requests, scale, layer_id, epoch } for PaintRequest { buffer_requests, scale, layer_id, epoch }
in requests.into_iter() { in requests.into_iter() {
if self.epoch == epoch { if self.epoch == epoch {
@ -263,7 +263,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
} }
} }
self.compositor.set_paint_state(self.id, IdleRenderState); self.compositor.set_paint_state(self.id, IdlePaintState);
debug!("paint_task: returning surfaces"); debug!("paint_task: returning surfaces");
self.compositor.paint(self.id, self.epoch, replies); self.compositor.paint(self.id, self.epoch, replies);

View file

@ -12,11 +12,11 @@ use std::fmt;
use constellation_msg::PipelineId; use constellation_msg::PipelineId;
/// The status of the renderer. /// The status of the painter.
#[deriving(PartialEq, Clone)] #[deriving(PartialEq, Clone)]
pub enum RenderState { pub enum PaintState {
IdleRenderState, IdlePaintState,
RenderingRenderState, PaintingPaintState,
} }
#[deriving(Eq, Ord, PartialEq, PartialOrd, Clone)] #[deriving(Eq, Ord, PartialEq, PartialOrd, Clone)]
@ -100,7 +100,7 @@ pub trait PaintListener for Sized? {
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, RenderState); fn set_paint_state(&mut self, PipelineId, PaintState);
} }
/// The interface used by the script task to tell the compositor to update its ready state, /// The interface used by the script task to tell the compositor to update its ready state,

View file

@ -19,7 +19,7 @@ use geom::scale_factor::ScaleFactor;
use geom::size::TypedSize2D; use geom::size::TypedSize2D;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use msg::compositor_msg::{IdleRenderState, RenderState}; use msg::compositor_msg::{IdlePaintState, PaintState};
use msg::compositor_msg::{Blank, ReadyState}; use msg::compositor_msg::{Blank, ReadyState};
use util::geometry::ScreenPx; use util::geometry::ScreenPx;
@ -41,7 +41,7 @@ pub struct Window {
pub mouse_down_point: Cell<Point2D<c_int>>, pub mouse_down_point: Cell<Point2D<c_int>>,
pub ready_state: Cell<ReadyState>, pub ready_state: Cell<ReadyState>,
pub render_state: Cell<RenderState>, pub render_state: Cell<PaintState>,
pub throbber_frame: Cell<u8>, pub throbber_frame: Cell<u8>,
} }
@ -65,7 +65,7 @@ impl Window {
mouse_down_point: Cell::new(Point2D(0 as c_int, 0)), mouse_down_point: Cell::new(Point2D(0 as c_int, 0)),
ready_state: Cell::new(Blank), ready_state: Cell::new(Blank),
render_state: Cell::new(IdleRenderState), render_state: Cell::new(IdlePaintState),
throbber_frame: Cell::new(0), throbber_frame: Cell::new(0),
}; };
@ -180,9 +180,9 @@ impl WindowMethods for Window {
//self.update_window_title() //self.update_window_title()
} }
/// Sets the render state. /// Sets the paint state.
fn set_render_state(&self, render_state: RenderState) { fn set_render_state(&self, paint_state: PaintState) {
self.render_state.set(render_state); self.render_state.set(paint_state);
//FIXME: set_window_title causes crash with Android version of freeGLUT. Temporarily blocked. //FIXME: set_window_title causes crash with Android version of freeGLUT. Temporarily blocked.
//self.update_window_title() //self.update_window_title()
} }
@ -216,10 +216,10 @@ impl Window {
// } // }
// FinishedLoading => { // FinishedLoading => {
// match self.render_state { // match self.render_state {
// RenderingRenderState => { // PaintingPaintState => {
// glut::set_window_title(self.glut_window, format!("{:c} Rendering . Servo", throbber)) // glut::set_window_title(self.glut_window, format!("{:c} Rendering . Servo", throbber))
// } // }
// IdleRenderState => glut::set_window_title(self.glut_window, "Servo"), // IdlePaintState => glut::set_window_title(self.glut_window, "Servo"),
// } // }
// } // }
// } // }

View file

@ -24,7 +24,7 @@ use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use libc::c_int; use libc::c_int;
use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState}; use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState};
use msg::compositor_msg::{IdleRenderState, RenderState, RenderingRenderState}; use msg::compositor_msg::{IdlePaintState, PaintState, PaintingPaintState};
use msg::constellation_msg; use msg::constellation_msg;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::comm::Receiver; use std::comm::Receiver;
@ -45,7 +45,7 @@ pub struct Window {
mouse_down_point: Cell<Point2D<c_int>>, mouse_down_point: Cell<Point2D<c_int>>,
ready_state: Cell<ReadyState>, ready_state: Cell<ReadyState>,
render_state: Cell<RenderState>, render_state: Cell<PaintState>,
last_title_set_time: Cell<Timespec>, last_title_set_time: Cell<Timespec>,
} }
@ -78,7 +78,7 @@ impl Window {
mouse_down_point: Cell::new(Point2D(0 as c_int, 0)), mouse_down_point: Cell::new(Point2D(0 as c_int, 0)),
ready_state: Cell::new(Blank), ready_state: Cell::new(Blank),
render_state: Cell::new(IdleRenderState), render_state: Cell::new(IdlePaintState),
last_title_set_time: Cell::new(Timespec::new(0, 0)), last_title_set_time: Cell::new(Timespec::new(0, 0)),
}; };
@ -159,9 +159,9 @@ impl WindowMethods for Window {
self.update_window_title() self.update_window_title()
} }
/// Sets the render state. /// Sets the paint state.
fn set_render_state(&self, render_state: RenderState) { fn set_render_state(&self, paint_state: PaintState) {
self.render_state.set(render_state); self.render_state.set(paint_state);
self.update_window_title() self.update_window_title()
} }
@ -303,10 +303,10 @@ impl Window {
} }
FinishedLoading => { FinishedLoading => {
match self.render_state.get() { match self.render_state.get() {
RenderingRenderState => { PaintingPaintState => {
self.glfw_window.set_title("Rendering — Servo [GLFW]") self.glfw_window.set_title("Rendering — Servo [GLFW]")
} }
IdleRenderState => { IdlePaintState => {
self.glfw_window.set_title("Servo [GLFW]") self.glfw_window.set_title("Servo [GLFW]")
} }
} }

View file

@ -18,7 +18,7 @@ use geom::size::TypedSize2D;
use gleam::gl; use gleam::gl;
use layers::geometry::DevicePixel; use layers::geometry::DevicePixel;
use layers::platform::surface::NativeGraphicsMetadata; use layers::platform::surface::NativeGraphicsMetadata;
use msg::compositor_msg::{IdleRenderState, RenderState, RenderingRenderState}; use msg::compositor_msg::{IdlePaintState, PaintState, PaintingPaintState};
use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState}; use msg::compositor_msg::{FinishedLoading, Blank, Loading, PerformingLayout, ReadyState};
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::rc::Rc; use std::rc::Rc;
@ -66,7 +66,7 @@ pub struct Window {
mouse_pos: Cell<Point2D<int>>, mouse_pos: Cell<Point2D<int>>,
ready_state: Cell<ReadyState>, ready_state: Cell<ReadyState>,
render_state: Cell<RenderState>, render_state: Cell<PaintState>,
key_modifiers: Cell<KeyModifiers>, key_modifiers: Cell<KeyModifiers>,
last_title_set_time: Cell<Timespec>, last_title_set_time: Cell<Timespec>,
@ -118,7 +118,7 @@ impl Window {
mouse_pos: Cell::new(Point2D(0, 0)), mouse_pos: Cell::new(Point2D(0, 0)),
ready_state: Cell::new(Blank), ready_state: Cell::new(Blank),
render_state: Cell::new(IdleRenderState), render_state: Cell::new(IdlePaintState),
key_modifiers: Cell::new(KeyModifiers::empty()), key_modifiers: Cell::new(KeyModifiers::empty()),
last_title_set_time: Cell::new(Timespec::new(0, 0)), last_title_set_time: Cell::new(Timespec::new(0, 0)),
@ -173,9 +173,9 @@ impl WindowMethods for Window {
self.update_window_title() self.update_window_title()
} }
/// Sets the render state. /// Sets the paint state.
fn set_render_state(&self, render_state: RenderState) { fn set_render_state(&self, paint_state: PaintState) {
self.render_state.set(render_state); self.render_state.set(paint_state);
self.update_window_title() self.update_window_title()
} }
@ -234,10 +234,10 @@ impl Window {
} }
FinishedLoading => { FinishedLoading => {
match self.render_state.get() { match self.render_state.get() {
RenderingRenderState => { PaintingPaintState => {
window.set_title("Rendering - Servo [glutin]") window.set_title("Rendering - Servo [glutin]")
} }
IdleRenderState => { IdlePaintState => {
window.set_title("Servo [glutin]") window.set_title("Servo [glutin]")
} }
} }