mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
fix constellation being inundated with messages from script.
script task sent RendererReadyMsg after every reflow. now, the renderer sends RendererReady at the appropriate time, and _only_ if it doesn't have paint permission.
This commit is contained in:
parent
84d731712f
commit
5f600f0ec0
4 changed files with 21 additions and 21 deletions
|
@ -9,7 +9,7 @@ use azure::azure_hl::{B8G8R8A8, DrawTarget};
|
||||||
use display_list::DisplayList;
|
use display_list::DisplayList;
|
||||||
use servo_msg::compositor_msg::{RenderListener, IdleRenderState, RenderingRenderState, LayerBuffer};
|
use servo_msg::compositor_msg::{RenderListener, IdleRenderState, RenderingRenderState, LayerBuffer};
|
||||||
use servo_msg::compositor_msg::{LayerBufferSet, Epoch};
|
use servo_msg::compositor_msg::{LayerBufferSet, Epoch};
|
||||||
use servo_msg::constellation_msg::PipelineId;
|
use servo_msg::constellation_msg::{ConstellationChan, PipelineId, RendererReadyMsg};
|
||||||
use font_context::FontContext;
|
use font_context::FontContext;
|
||||||
use geom::matrix2d::Matrix2D;
|
use geom::matrix2d::Matrix2D;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
|
@ -17,8 +17,8 @@ use geom::rect::Rect;
|
||||||
use opts::Opts;
|
use opts::Opts;
|
||||||
use render_context::RenderContext;
|
use render_context::RenderContext;
|
||||||
|
|
||||||
use std::cell::Cell;
|
|
||||||
use std::comm::{Chan, Port, SharedChan};
|
use std::comm::{Chan, Port, SharedChan};
|
||||||
|
use std::task::spawn_with;
|
||||||
use extra::arc::Arc;
|
use extra::arc::Arc;
|
||||||
|
|
||||||
use servo_util::time::{ProfilerChan, profile};
|
use servo_util::time::{ProfilerChan, profile};
|
||||||
|
@ -86,6 +86,7 @@ struct RenderTask<C,T> {
|
||||||
id: PipelineId,
|
id: PipelineId,
|
||||||
port: Port<Msg<T>>,
|
port: Port<Msg<T>>,
|
||||||
compositor: C,
|
compositor: C,
|
||||||
|
constellation_chan: ConstellationChan,
|
||||||
font_ctx: @mut FontContext,
|
font_ctx: @mut FontContext,
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
|
|
||||||
|
@ -110,24 +111,21 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> {
|
||||||
pub fn create(id: PipelineId,
|
pub fn create(id: PipelineId,
|
||||||
port: Port<Msg<T>>,
|
port: Port<Msg<T>>,
|
||||||
compositor: C,
|
compositor: C,
|
||||||
|
constellation_chan: ConstellationChan,
|
||||||
opts: Opts,
|
opts: Opts,
|
||||||
profiler_chan: ProfilerChan) {
|
profiler_chan: ProfilerChan) {
|
||||||
let compositor = Cell::new(compositor);
|
|
||||||
let opts = Cell::new(opts);
|
|
||||||
let port = Cell::new(port);
|
|
||||||
let profiler_chan = Cell::new(profiler_chan);
|
|
||||||
|
|
||||||
do spawn {
|
do spawn_with((port, compositor, constellation_chan, opts, profiler_chan))
|
||||||
let compositor = compositor.take();
|
|(port, compositor, constellation_chan, opts, profiler_chan)| {
|
||||||
|
|
||||||
let share_gl_context = compositor.get_gl_context();
|
let share_gl_context = compositor.get_gl_context();
|
||||||
let opts = opts.take();
|
|
||||||
let profiler_chan = profiler_chan.take();
|
|
||||||
|
|
||||||
// FIXME: rust/#5967
|
// FIXME: rust/#5967
|
||||||
let mut render_task = RenderTask {
|
let mut render_task = RenderTask {
|
||||||
id: id,
|
id: id,
|
||||||
port: port.take(),
|
port: port,
|
||||||
compositor: compositor,
|
compositor: compositor,
|
||||||
|
constellation_chan: constellation_chan,
|
||||||
font_ctx: @mut FontContext::new(opts.render_backend.clone(),
|
font_ctx: @mut FontContext::new(opts.render_backend.clone(),
|
||||||
false,
|
false,
|
||||||
profiler_chan.clone()),
|
profiler_chan.clone()),
|
||||||
|
@ -155,6 +153,8 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> {
|
||||||
if self.paint_permission {
|
if self.paint_permission {
|
||||||
self.epoch.next();
|
self.epoch.next();
|
||||||
self.compositor.set_layer_page_size(self.id, render_layer.size, self.epoch);
|
self.compositor.set_layer_page_size(self.id, render_layer.size, self.epoch);
|
||||||
|
} else {
|
||||||
|
self.constellation_chan.send(RendererReadyMsg(self.id));
|
||||||
}
|
}
|
||||||
self.render_layer = Some(render_layer);
|
self.render_layer = Some(render_layer);
|
||||||
self.last_paint_msg = None;
|
self.last_paint_msg = None;
|
||||||
|
@ -284,6 +284,8 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> {
|
||||||
debug!("render_task: returning surface");
|
debug!("render_task: returning surface");
|
||||||
if self.paint_permission {
|
if self.paint_permission {
|
||||||
self.compositor.paint(self.id, layer_buffer_set.clone(), self.epoch);
|
self.compositor.paint(self.id, layer_buffer_set.clone(), self.epoch);
|
||||||
|
} else {
|
||||||
|
self.constellation_chan.send(RendererReadyMsg(self.id));
|
||||||
}
|
}
|
||||||
debug!("caching paint msg");
|
debug!("caching paint msg");
|
||||||
self.last_paint_msg = Some(layer_buffer_set);
|
self.last_paint_msg = Some(layer_buffer_set);
|
||||||
|
|
|
@ -201,20 +201,18 @@ impl NavigationContext {
|
||||||
pub fn back(&mut self) -> @mut FrameTree {
|
pub fn back(&mut self) -> @mut FrameTree {
|
||||||
self.next.push(self.current.take_unwrap());
|
self.next.push(self.current.take_unwrap());
|
||||||
self.current = Some(self.previous.pop());
|
self.current = Some(self.previous.pop());
|
||||||
debug!("previous: %? next: %? current: %?", self.previous, self.next, *self.current.get_ref());
|
|
||||||
self.current.unwrap()
|
self.current.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn forward(&mut self) -> @mut FrameTree {
|
pub fn forward(&mut self) -> @mut FrameTree {
|
||||||
self.previous.push(self.current.take_unwrap());
|
self.previous.push(self.current.take_unwrap());
|
||||||
self.current = Some(self.next.pop());
|
self.current = Some(self.next.pop());
|
||||||
debug!("previous: %? next: %? current: %?", self.previous, self.next, *self.current.get_ref());
|
|
||||||
self.current.unwrap()
|
self.current.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a new set of page frames, returning all evicted frame trees
|
/// Loads a new set of page frames, returning all evicted frame trees
|
||||||
pub fn load(&mut self, frame_tree: @mut FrameTree) -> ~[@mut FrameTree] {
|
pub fn load(&mut self, frame_tree: @mut FrameTree) -> ~[@mut FrameTree] {
|
||||||
debug!("navigating to %?", frame_tree);
|
debug!("navigating to %?", frame_tree.pipeline.id);
|
||||||
let evicted = replace(&mut self.next, ~[]);
|
let evicted = replace(&mut self.next, ~[]);
|
||||||
if self.current.is_some() {
|
if self.current.is_some() {
|
||||||
self.previous.push(self.current.take_unwrap());
|
self.previous.push(self.current.take_unwrap());
|
||||||
|
@ -554,7 +552,7 @@ impl Constellation {
|
||||||
if url.path.ends_with(".js") {
|
if url.path.ends_with(".js") {
|
||||||
pipeline.execute(url);
|
pipeline.execute(url);
|
||||||
} else {
|
} else {
|
||||||
debug!("Constellation: sending load msg to %?", pipeline);
|
debug!("Constellation: sending load msg to pipeline %?", pipeline.id);
|
||||||
pipeline.load(url);
|
pipeline.load(url);
|
||||||
}
|
}
|
||||||
let rect = self.pending_sizes.pop(&(source_pipeline_id, subpage_id));
|
let rect = self.pending_sizes.pop(&(source_pipeline_id, subpage_id));
|
||||||
|
@ -718,12 +716,11 @@ impl Constellation {
|
||||||
|
|
||||||
// If to_add is not the root frame, then replace revoked_frame with it.
|
// If to_add is not the root frame, then replace revoked_frame with it.
|
||||||
// This conveniently keeps scissor rect size intact.
|
// This conveniently keeps scissor rect size intact.
|
||||||
debug!("Constellation: replacing %? with %? in %?", revoke_id, to_add, next_frame_tree);
|
debug!("Constellation: replacing %? with %? in %?",
|
||||||
|
revoke_id, to_add.pipeline.id, next_frame_tree.pipeline.id);
|
||||||
if to_add.parent.is_some() {
|
if to_add.parent.is_some() {
|
||||||
let replaced = next_frame_tree.replace_child(revoke_id, to_add);
|
next_frame_tree.replace_child(revoke_id, to_add);
|
||||||
debug!("Replaced child: %?", replaced);
|
|
||||||
}
|
}
|
||||||
debug!("Constellation: frame tree after replacing: %?", next_frame_tree);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -54,6 +54,7 @@ impl Pipeline {
|
||||||
RenderTask::create(id,
|
RenderTask::create(id,
|
||||||
render_port,
|
render_port,
|
||||||
compositor_chan.clone(),
|
compositor_chan.clone(),
|
||||||
|
constellation_chan.clone(),
|
||||||
opts.clone(),
|
opts.clone(),
|
||||||
profiler_chan.clone());
|
profiler_chan.clone());
|
||||||
|
|
||||||
|
@ -136,6 +137,7 @@ impl Pipeline {
|
||||||
RenderTask::create(id,
|
RenderTask::create(id,
|
||||||
render_port,
|
render_port,
|
||||||
compositor_chan.clone(),
|
compositor_chan.clone(),
|
||||||
|
constellation_chan.clone(),
|
||||||
opts.clone(),
|
opts.clone(),
|
||||||
profiler_chan.clone());
|
profiler_chan.clone());
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use layout_interface::{ReflowDocumentDamage, ReflowForDisplay, ReflowGoal};
|
||||||
use layout_interface::ReflowMsg;
|
use layout_interface::ReflowMsg;
|
||||||
use layout_interface;
|
use layout_interface;
|
||||||
use servo_msg::constellation_msg::{ConstellationChan, LoadUrlMsg, NavigationDirection};
|
use servo_msg::constellation_msg::{ConstellationChan, LoadUrlMsg, NavigationDirection};
|
||||||
use servo_msg::constellation_msg::{PipelineId, SubpageId, RendererReadyMsg};
|
use servo_msg::constellation_msg::{PipelineId, SubpageId};
|
||||||
use servo_msg::constellation_msg::{LoadIframeUrlMsg, IFrameSandboxed, IFrameUnsandboxed};
|
use servo_msg::constellation_msg::{LoadIframeUrlMsg, IFrameSandboxed, IFrameUnsandboxed};
|
||||||
use servo_msg::constellation_msg;
|
use servo_msg::constellation_msg;
|
||||||
|
|
||||||
|
@ -582,7 +582,6 @@ impl ScriptTask {
|
||||||
if page_tree.page.last_reflow_id == reflow_id {
|
if page_tree.page.last_reflow_id == reflow_id {
|
||||||
page_tree.page.layout_join_port = None;
|
page_tree.page.layout_join_port = None;
|
||||||
}
|
}
|
||||||
self.constellation_chan.send(RendererReadyMsg(pipeline_id));
|
|
||||||
self.compositor.set_ready_state(FinishedLoading);
|
self.compositor.set_ready_state(FinishedLoading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue