mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Store one RenderState per-pipeline in the Compositor
This can later be used to decide whether the entire pipeline is ready for rendering.
This commit is contained in:
parent
c182308350
commit
0e86679464
4 changed files with 16 additions and 10 deletions
|
@ -104,6 +104,9 @@ pub struct IOCompositor {
|
||||||
/// 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.
|
||||||
|
render_states: HashMap<PipelineId, RenderState>,
|
||||||
|
|
||||||
/// 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)
|
||||||
/// many times for a single page.
|
/// many times for a single page.
|
||||||
|
@ -167,6 +170,7 @@ impl IOCompositor {
|
||||||
zoom_action: false,
|
zoom_action: false,
|
||||||
zoom_time: 0f64,
|
zoom_time: 0f64,
|
||||||
ready_states: HashMap::new(),
|
ready_states: HashMap::new(),
|
||||||
|
render_states: HashMap::new(),
|
||||||
load_complete: false,
|
load_complete: false,
|
||||||
constellation_chan: constellation_chan,
|
constellation_chan: constellation_chan,
|
||||||
time_profiler_chan: time_profiler_chan,
|
time_profiler_chan: time_profiler_chan,
|
||||||
|
@ -280,8 +284,8 @@ impl IOCompositor {
|
||||||
self.change_ready_state(pipeline_id, ready_state);
|
self.change_ready_state(pipeline_id, ready_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Ok(ChangeRenderState(render_state)), NotShuttingDown) => {
|
(Ok(ChangeRenderState(pipeline_id, render_state)), NotShuttingDown) => {
|
||||||
self.change_render_state(render_state);
|
self.change_render_state(pipeline_id, render_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Ok(RenderMsgDiscarded), NotShuttingDown) => {
|
(Ok(RenderMsgDiscarded), NotShuttingDown) => {
|
||||||
|
@ -348,7 +352,10 @@ impl IOCompositor {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn change_render_state(&mut self, render_state: RenderState) {
|
fn change_render_state(&mut self, pipeline_id: PipelineId, render_state: RenderState) {
|
||||||
|
self.render_states.insert_or_update_with(pipeline_id,
|
||||||
|
render_state,
|
||||||
|
|_key, value| *value = render_state);
|
||||||
self.window.set_render_state(render_state);
|
self.window.set_render_state(render_state);
|
||||||
if render_state == IdleRenderState {
|
if render_state == IdleRenderState {
|
||||||
self.composite_ready = true;
|
self.composite_ready = true;
|
||||||
|
|
|
@ -126,8 +126,8 @@ impl RenderListener for CompositorChan {
|
||||||
self.chan.send(RenderMsgDiscarded);
|
self.chan.send(RenderMsgDiscarded);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_render_state(&self, render_state: RenderState) {
|
fn set_render_state(&self, pipeline_id: PipelineId, render_state: RenderState) {
|
||||||
self.chan.send(ChangeRenderState(render_state))
|
self.chan.send(ChangeRenderState(pipeline_id, render_state))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ pub enum Msg {
|
||||||
/// 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 rendering.
|
||||||
ChangeRenderState(RenderState),
|
ChangeRenderState(PipelineId, RenderState),
|
||||||
/// Alerts the compositor that the RenderMsg has been discarded.
|
/// Alerts the compositor that the RenderMsg has been discarded.
|
||||||
RenderMsgDiscarded,
|
RenderMsgDiscarded,
|
||||||
/// 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
|
||||||
|
|
|
@ -234,9 +234,8 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.compositor.set_render_state(RenderingRenderState);
|
|
||||||
|
|
||||||
let mut replies = Vec::new();
|
let mut replies = Vec::new();
|
||||||
|
self.compositor.set_render_state(self.id, RenderingRenderState);
|
||||||
for RenderRequest { buffer_requests, scale, layer_id, epoch }
|
for RenderRequest { buffer_requests, scale, layer_id, epoch }
|
||||||
in requests.move_iter() {
|
in requests.move_iter() {
|
||||||
if self.epoch == epoch {
|
if self.epoch == epoch {
|
||||||
|
@ -246,7 +245,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.compositor.set_render_state(IdleRenderState);
|
self.compositor.set_render_state(self.id, IdleRenderState);
|
||||||
|
|
||||||
debug!("render_task: returning surfaces");
|
debug!("render_task: returning surfaces");
|
||||||
self.compositor.paint(self.id, self.epoch, replies);
|
self.compositor.paint(self.id, self.epoch, replies);
|
||||||
|
|
|
@ -101,7 +101,7 @@ pub trait RenderListener {
|
||||||
replies: Vec<(LayerId, Box<LayerBufferSet>)>);
|
replies: Vec<(LayerId, Box<LayerBufferSet>)>);
|
||||||
|
|
||||||
fn render_msg_discarded(&self);
|
fn render_msg_discarded(&self);
|
||||||
fn set_render_state(&self, render_state: RenderState);
|
fn set_render_state(&self, PipelineId, RenderState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue