mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38:59 +01:00
new token-permissions model, and compositor filters paint messages based on id
This commit is contained in:
parent
a6eaffcd93
commit
c9c6cb3bf5
12 changed files with 148 additions and 147 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use servo_msg::compositor::LayerBuffer;
|
||||
use servo_msg::compositor_msg::LayerBuffer;
|
||||
use font_context::FontContext;
|
||||
use geometry::Au;
|
||||
use opts::Opts;
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
use azure::{AzFloat, AzGLContext};
|
||||
use azure::azure_hl::{B8G8R8A8, DrawTarget};
|
||||
use display_list::DisplayList;
|
||||
use servo_msg::compositor::{RenderListener, IdleRenderState, RenderingRenderState, LayerBuffer};
|
||||
use servo_msg::compositor::{CompositorToken, LayerBufferSet};
|
||||
use servo_msg::constellation::{ConstellationChan, TokenSurrenderMsg};
|
||||
use servo_msg::compositor_msg::{RenderListener, IdleRenderState, RenderingRenderState, LayerBuffer};
|
||||
use servo_msg::compositor_msg::{CompositorToken, LayerBufferSet};
|
||||
use servo_msg::constellation_msg::{ConstellationChan};
|
||||
use font_context::FontContext;
|
||||
use geom::matrix2d::Matrix2D;
|
||||
use geom::point::Point2D;
|
||||
|
@ -33,8 +33,8 @@ pub struct RenderLayer {
|
|||
pub enum Msg {
|
||||
RenderMsg(RenderLayer),
|
||||
ReRenderMsg(f32),
|
||||
TokenBestowMsg(~CompositorToken),
|
||||
TokenProcureMsg,
|
||||
TokenBestowMsg(CompositorToken),
|
||||
TokenInvalidateMsg,
|
||||
ExitMsg(Chan<()>),
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ impl RenderChan {
|
|||
}
|
||||
|
||||
priv struct RenderTask<C> {
|
||||
id: uint,
|
||||
port: Port<Msg>,
|
||||
compositor: C,
|
||||
font_ctx: @mut FontContext,
|
||||
|
@ -70,13 +71,14 @@ priv struct RenderTask<C> {
|
|||
/// A channel to the constellation for surrendering token
|
||||
constellation_chan: ConstellationChan,
|
||||
/// A token that grants permission to send paint messages to compositor
|
||||
compositor_token: Option<~CompositorToken>,
|
||||
compositor_token: Option<CompositorToken>,
|
||||
/// Cached copy of last layers rendered
|
||||
last_paint_msg: Option<(LayerBufferSet, Size2D<uint>)>,
|
||||
}
|
||||
|
||||
impl<C: RenderListener + Owned> RenderTask<C> {
|
||||
pub fn create(port: Port<Msg>,
|
||||
pub fn create(id: uint,
|
||||
port: Port<Msg>,
|
||||
compositor: C,
|
||||
opts: Opts,
|
||||
constellation_chan: ConstellationChan,
|
||||
|
@ -95,6 +97,7 @@ impl<C: RenderListener + Owned> RenderTask<C> {
|
|||
|
||||
// FIXME: rust/#5967
|
||||
let mut render_task = RenderTask {
|
||||
id: id,
|
||||
port: port.take(),
|
||||
compositor: compositor,
|
||||
font_ctx: @mut FontContext::new(opts.render_backend,
|
||||
|
@ -130,14 +133,14 @@ impl<C: RenderListener + Owned> RenderTask<C> {
|
|||
self.compositor_token = Some(token);
|
||||
match self.last_paint_msg {
|
||||
Some((ref layer_buffer_set, ref layer_size)) => {
|
||||
self.compositor.paint(layer_buffer_set.clone(), *layer_size);
|
||||
self.compositor.paint(self.id, layer_buffer_set.clone(), *layer_size);
|
||||
self.compositor.set_render_state(IdleRenderState);
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
TokenProcureMsg => {
|
||||
self.constellation_chan.send(TokenSurrenderMsg(self.compositor_token.swap_unwrap()));
|
||||
TokenInvalidateMsg => {
|
||||
self.compositor_token = None;
|
||||
}
|
||||
ExitMsg(response_ch) => {
|
||||
response_ch.send(());
|
||||
|
@ -232,7 +235,7 @@ impl<C: RenderListener + Owned> RenderTask<C> {
|
|||
|
||||
debug!("render_task: returning surface");
|
||||
if self.compositor_token.is_some() {
|
||||
self.compositor.paint(layer_buffer_set.clone(), render_layer.size);
|
||||
self.compositor.paint(self.id, layer_buffer_set.clone(), render_layer.size);
|
||||
}
|
||||
debug!("caching paint msg");
|
||||
self.last_paint_msg = Some((layer_buffer_set, render_layer.size));
|
||||
|
|
|
@ -9,9 +9,11 @@ use script::layout_interface::{LayoutChan, RouteScriptMsg};
|
|||
use windowing::{ApplicationMethods, WindowMethods, WindowMouseEvent, WindowClickEvent};
|
||||
use windowing::{WindowMouseDownEvent, WindowMouseUpEvent};
|
||||
|
||||
use servo_msg::compositor::{RenderListener, LayerBufferSet, RenderState};
|
||||
use servo_msg::compositor::{ReadyState, ScriptListener};
|
||||
use servo_msg::constellation;
|
||||
|
||||
use servo_msg::compositor_msg::{RenderListener, LayerBufferSet, RenderState};
|
||||
use servo_msg::compositor_msg::{ReadyState, ScriptListener};
|
||||
use servo_msg::constellation_msg::{CompositorAck, ConstellationChan};
|
||||
use servo_msg::constellation_msg;
|
||||
use gfx::render_task::{RenderChan, ReRenderMsg};
|
||||
|
||||
use azure::azure_hl::{DataSourceSurface, DrawTarget, SourceSurfaceMethods, current_gl_context};
|
||||
|
@ -58,8 +60,8 @@ impl RenderListener for CompositorChan {
|
|||
self.chan.send(GetGLContext(chan));
|
||||
port.recv()
|
||||
}
|
||||
fn paint(&self, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>) {
|
||||
self.chan.send(Paint(layer_buffer_set, new_size))
|
||||
fn paint(&self, id: uint, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>) {
|
||||
self.chan.send(Paint(id, layer_buffer_set, new_size))
|
||||
}
|
||||
fn set_render_state(&self, render_state: RenderState) {
|
||||
self.chan.send(ChangeRenderState(render_state))
|
||||
|
@ -84,15 +86,13 @@ pub enum Msg {
|
|||
/// Requests the compositors GL context.
|
||||
GetGLContext(Chan<AzGLContext>),
|
||||
/// Requests that the compositor paint the given layer buffer set for the given page size.
|
||||
Paint(LayerBufferSet, Size2D<uint>),
|
||||
Paint(uint, LayerBufferSet, Size2D<uint>),
|
||||
/// Alerts the compositor to the current status of page loading.
|
||||
ChangeReadyState(ReadyState),
|
||||
/// Alerts the compositor to the current status of rendering.
|
||||
ChangeRenderState(RenderState),
|
||||
/// Sets the channel to the current layout task
|
||||
SetLayoutChan(LayoutChan),
|
||||
/// Sets the channel to the current renderer
|
||||
SetRenderChan(RenderChan),
|
||||
/// Sets the channel to the current layout and render tasks, along with their id
|
||||
SetLayoutRenderChans(LayoutChan, RenderChan , uint, ConstellationChan)
|
||||
}
|
||||
|
||||
/// Azure surface wrapping to work with the layers infrastructure.
|
||||
|
@ -180,13 +180,14 @@ impl CompositorTask {
|
|||
// Channel to the current renderer.
|
||||
// FIXME: This probably shouldn't be stored like this.
|
||||
let render_chan: @mut Option<RenderChan> = @mut None;
|
||||
let pipeline_id: @mut Option<uint> = @mut None;
|
||||
|
||||
let update_layout_callbacks: @fn(LayoutChan) = |layout_chan: LayoutChan| {
|
||||
let layout_chan_clone = layout_chan.clone();
|
||||
do window.set_navigation_callback |direction| {
|
||||
let direction = match direction {
|
||||
windowing::Forward => constellation::Forward,
|
||||
windowing::Back => constellation::Back,
|
||||
windowing::Forward => constellation_msg::Forward,
|
||||
windowing::Back => constellation_msg::Back,
|
||||
};
|
||||
layout_chan_clone.send(RouteScriptMsg(NavigateMsg(direction)));
|
||||
}
|
||||
|
@ -254,17 +255,24 @@ impl CompositorTask {
|
|||
ChangeReadyState(ready_state) => window.set_ready_state(ready_state),
|
||||
ChangeRenderState(render_state) => window.set_render_state(render_state),
|
||||
|
||||
SetLayoutChan(layout_chan) => {
|
||||
update_layout_callbacks(layout_chan);
|
||||
}
|
||||
|
||||
SetRenderChan(new_render_chan) => {
|
||||
SetLayoutRenderChans(new_layout_chan,
|
||||
new_render_chan,
|
||||
new_pipeline_id,
|
||||
response_chan) => {
|
||||
update_layout_callbacks(new_layout_chan);
|
||||
*render_chan = Some(new_render_chan);
|
||||
*pipeline_id = Some(new_pipeline_id);
|
||||
response_chan.send(CompositorAck(new_pipeline_id));
|
||||
}
|
||||
|
||||
GetGLContext(chan) => chan.send(current_gl_context()),
|
||||
|
||||
Paint(new_layer_buffer_set, new_size) => {
|
||||
Paint(id, new_layer_buffer_set, new_size) => {
|
||||
match *pipeline_id {
|
||||
Some(pipeline_id) => if id != pipeline_id { loop; },
|
||||
None => { loop; },
|
||||
}
|
||||
|
||||
debug!("osmain: received new frame");
|
||||
|
||||
*page_size = Size2D(new_size.width as f32, new_size.height as f32);
|
||||
|
|
|
@ -2,18 +2,19 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use compositing::{CompositorChan, SetLayoutChan, SetRenderChan};
|
||||
use compositing::{CompositorChan, SetLayoutRenderChans};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::comm;
|
||||
use std::comm::Port;
|
||||
use std::task;
|
||||
use gfx::opts::Opts;
|
||||
use gfx::render_task::{TokenBestowMsg, TokenProcureMsg};
|
||||
use gfx::render_task::{TokenBestowMsg, TokenInvalidateMsg};
|
||||
use pipeline::Pipeline;
|
||||
use servo_msg::compositor::{CompositorToken};
|
||||
use servo_msg::constellation::{ConstellationChan, ExitMsg, LoadUrlMsg, Msg, NavigateMsg};
|
||||
use servo_msg::constellation::{Forward, Back, RendererReadyMsg, TokenSurrenderMsg};
|
||||
use servo_msg::compositor_msg::{CompositorToken};
|
||||
use servo_msg::constellation_msg::{CompositorAck, ConstellationChan, ExitMsg};
|
||||
use servo_msg::constellation_msg::{LoadUrlMsg, Msg, NavigateMsg, RendererReadyMsg};
|
||||
use servo_msg::constellation_msg;
|
||||
use script::script_task::ExecuteMsg;
|
||||
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
|
||||
use servo_net::resource_task::ResourceTask;
|
||||
|
@ -22,6 +23,7 @@ use servo_util::time::ProfilerChan;
|
|||
use std::hashmap::HashMap;
|
||||
use std::util::replace;
|
||||
|
||||
/// Maintains the pipelines and navigation context and grants permission to composite
|
||||
pub struct Constellation {
|
||||
chan: ConstellationChan,
|
||||
request_port: Port<Msg>,
|
||||
|
@ -32,18 +34,11 @@ pub struct Constellation {
|
|||
navigation_context: NavigationContext,
|
||||
next_id: uint,
|
||||
current_token_bearer: Option<uint>,
|
||||
next_token_bearer: Option<(uint, NavigationType)>,
|
||||
compositor_token: Option<~CompositorToken>,
|
||||
next_token_bearer: Option<uint>,
|
||||
profiler_chan: ProfilerChan,
|
||||
opts: Opts,
|
||||
}
|
||||
|
||||
/// Represents the two different ways to which a page can be navigated
|
||||
enum NavigationType {
|
||||
Load, // entered or clicked on a url
|
||||
Navigate, // browser forward/back buttons
|
||||
}
|
||||
|
||||
/// Stores the ID's of the pipelines previous and next in the browser's history
|
||||
pub struct NavigationContext {
|
||||
previous: ~[uint],
|
||||
|
@ -60,6 +55,9 @@ impl NavigationContext {
|
|||
}
|
||||
}
|
||||
|
||||
/* Note that the following two methods can fail. They should only be called *
|
||||
* when it is known that, e.g., there exists a previous page or a next page. */
|
||||
|
||||
pub fn back(&mut self) -> uint {
|
||||
self.next.push(self.current.get());
|
||||
self.current = Some(self.previous.pop());
|
||||
|
@ -75,6 +73,7 @@ impl NavigationContext {
|
|||
}
|
||||
|
||||
pub fn navigate(&mut self, id: uint) {
|
||||
self.next.clear();
|
||||
do self.current.mutate_default(id) |cur_id| {
|
||||
self.previous.push(cur_id);
|
||||
id
|
||||
|
@ -98,7 +97,6 @@ impl Constellation {
|
|||
|
||||
let compositor_chan = Cell::new(compositor_chan);
|
||||
let constellation_chan_clone = Cell::new(constellation_chan.clone());
|
||||
{
|
||||
do task::spawn {
|
||||
let mut constellation = Constellation {
|
||||
chan: constellation_chan_clone.take(),
|
||||
|
@ -111,13 +109,11 @@ impl Constellation {
|
|||
next_id: 0,
|
||||
current_token_bearer: None,
|
||||
next_token_bearer: None,
|
||||
compositor_token: Some(~CompositorToken::new()),
|
||||
profiler_chan: profiler_chan.clone(),
|
||||
opts: opts.take(),
|
||||
};
|
||||
constellation.run();
|
||||
}
|
||||
}
|
||||
constellation_chan
|
||||
}
|
||||
|
||||
|
@ -140,6 +136,7 @@ impl Constellation {
|
|||
/// Handles loading pages, navigation, and granting access to the compositor
|
||||
fn handle_request(&mut self, request: Msg) -> bool {
|
||||
match request {
|
||||
// Load a new page, usually either from a mouse click or typed url
|
||||
LoadUrlMsg(url) => {
|
||||
let pipeline_id = self.get_next_id();
|
||||
let mut pipeline = Pipeline::create(pipeline_id,
|
||||
|
@ -153,22 +150,24 @@ impl Constellation {
|
|||
pipeline.script_chan.send(ExecuteMsg(url));
|
||||
} else {
|
||||
pipeline.load(url);
|
||||
self.next_token_bearer = Some((pipeline_id, Load));
|
||||
pipeline.navigation_type = Some(constellation_msg::Load);
|
||||
self.next_token_bearer = Some(pipeline_id);
|
||||
}
|
||||
self.pipelines.insert(pipeline_id, pipeline);
|
||||
}
|
||||
|
||||
// Handle a forward or back request
|
||||
NavigateMsg(direction) => {
|
||||
debug!("received message to navigate %?", direction);
|
||||
let destination_id = match direction {
|
||||
Forward => {
|
||||
constellation_msg::Forward => {
|
||||
if self.navigation_context.next.is_empty() {
|
||||
debug!("no next page to navigate to");
|
||||
return true
|
||||
}
|
||||
self.navigation_context.forward()
|
||||
}
|
||||
Back => {
|
||||
constellation_msg::Back => {
|
||||
if self.navigation_context.previous.is_empty() {
|
||||
debug!("no previous page to navigate to");
|
||||
return true
|
||||
|
@ -177,27 +176,27 @@ impl Constellation {
|
|||
}
|
||||
};
|
||||
debug!("navigating to pipeline %u", destination_id);
|
||||
self.pipelines.get(&destination_id).reload();
|
||||
self.next_token_bearer = Some((destination_id, Navigate));
|
||||
self.procure_or_bestow();
|
||||
let mut pipeline = self.pipelines.pop(&destination_id).unwrap();
|
||||
pipeline.navigation_type = Some(constellation_msg::Navigate);
|
||||
pipeline.reload();
|
||||
self.pipelines.insert(destination_id, pipeline);
|
||||
self.next_token_bearer = Some(destination_id);
|
||||
self.update_token_bearer();
|
||||
}
|
||||
|
||||
// Notification that rendering has finished and is requesting permission to paint.
|
||||
RendererReadyMsg(pipeline_id) => {
|
||||
let next_token_bearer = self.next_token_bearer;
|
||||
for next_token_bearer.iter().advance |&(id, _)| {
|
||||
for next_token_bearer.iter().advance |&id| {
|
||||
if pipeline_id == id {
|
||||
self.procure_or_bestow();
|
||||
self.update_token_bearer();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TokenSurrenderMsg(token) => {
|
||||
self.remove_active_pipeline();
|
||||
let token = Cell::new(token);
|
||||
let next_token_bearer = self.next_token_bearer;
|
||||
for next_token_bearer.iter().advance |&(id, nav_type)| {
|
||||
self.bestow_compositor_token(id, token.take(), nav_type);
|
||||
};
|
||||
// Acknowledgement from the compositor that it has updated its active pipeline id
|
||||
CompositorAck(id) => {
|
||||
self.bestow_compositor_token(id);
|
||||
}
|
||||
|
||||
ExitMsg(sender) => {
|
||||
|
@ -214,43 +213,28 @@ impl Constellation {
|
|||
true
|
||||
}
|
||||
|
||||
/// Either procures the token, sends the token to next bearer, or does nothing if waiting for token surrender.
|
||||
fn procure_or_bestow(&mut self) {
|
||||
fn update_token_bearer(&mut self) {
|
||||
let current_token_bearer = replace(&mut self.current_token_bearer, None);
|
||||
match current_token_bearer {
|
||||
Some(ref id) => {
|
||||
let pipeline = self.pipelines.get(id);
|
||||
pipeline.render_chan.send(TokenProcureMsg);
|
||||
for current_token_bearer.iter().advance |id| {
|
||||
self.pipelines.get(id).render_chan.send(TokenInvalidateMsg);
|
||||
}
|
||||
None => {
|
||||
let compositor_token = replace(&mut self.compositor_token, None);
|
||||
for compositor_token.iter().advance |&token| {
|
||||
let (id, nav_type) = self.next_token_bearer.get();
|
||||
self.bestow_compositor_token(id, token, nav_type);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn remove_active_pipeline(&mut self) {
|
||||
// FIXME(tkuehn): currently, pipelines are not removed at all
|
||||
// do self.current_token_bearer.map |id| {
|
||||
// self.pipelines.pop(id).unwrap().exit();
|
||||
// };
|
||||
|
||||
self.current_token_bearer = None;
|
||||
}
|
||||
|
||||
fn bestow_compositor_token(&mut self, id: uint, compositor_token: ~CompositorToken, navigation_type: NavigationType) {
|
||||
let id = self.next_token_bearer.get();
|
||||
let pipeline = self.pipelines.get(&id);
|
||||
pipeline.render_chan.send(TokenBestowMsg(compositor_token));
|
||||
self.compositor_chan.send(SetLayoutChan(pipeline.layout_chan.clone()));
|
||||
self.compositor_chan.send(SetRenderChan(pipeline.render_chan.clone()));
|
||||
self.compositor_chan.send(SetLayoutRenderChans(pipeline.layout_chan.clone(),
|
||||
pipeline.render_chan.clone(),
|
||||
id,
|
||||
self.chan.clone()));
|
||||
}
|
||||
|
||||
// Sends a compositor token to a renderer; optionally updates navigation to reflect a new page
|
||||
fn bestow_compositor_token(&mut self, id: uint) {
|
||||
let pipeline = self.pipelines.get(&id);
|
||||
pipeline.render_chan.send(TokenBestowMsg(CompositorToken::new()));
|
||||
self.current_token_bearer = Some(id);
|
||||
self.next_token_bearer = None;
|
||||
// Don't navigate on Navigate type, because that is handled by forward/back
|
||||
match navigation_type {
|
||||
Load => self.navigation_context.navigate(id),
|
||||
match pipeline.navigation_type.get() {
|
||||
constellation_msg::Load => self.navigation_context.navigate(id),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,23 @@ use gfx::opts::Opts;
|
|||
use layout::layout_task::LayoutTask;
|
||||
use script::layout_interface::LayoutChan;
|
||||
use script::script_task::LoadMsg;
|
||||
use servo_msg::constellation::{ConstellationChan};
|
||||
use script::script_task::{ScriptTask, ScriptChan, ScriptMsg};
|
||||
use servo_msg::constellation_msg::{ConstellationChan, NavigationType};
|
||||
use script::script_task::{ScriptTask, ScriptChan};
|
||||
use script::script_task;
|
||||
use servo_net::image_cache_task::ImageCacheTask;
|
||||
use servo_net::resource_task::ResourceTask;
|
||||
use servo_util::time::ProfilerChan;
|
||||
use std::comm;
|
||||
|
||||
macro_rules! special_stream(
|
||||
($Chan:ident) => (
|
||||
{
|
||||
let (port, chan) = comm::stream::();
|
||||
(port, $Chan::new(chan))
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
/// A uniquely-identifiable pipeline of stript task, layout task, and render task.
|
||||
pub struct Pipeline {
|
||||
id: uint,
|
||||
|
@ -26,6 +35,7 @@ pub struct Pipeline {
|
|||
render_chan: RenderChan,
|
||||
/// The most recently loaded url
|
||||
url: Option<Url>,
|
||||
navigation_type: Option<NavigationType>,
|
||||
}
|
||||
|
||||
impl Pipeline {
|
||||
|
@ -38,24 +48,12 @@ impl Pipeline {
|
|||
profiler_chan: ProfilerChan,
|
||||
opts: Opts) -> Pipeline {
|
||||
|
||||
macro_rules! closure_stream(
|
||||
($Msg:ty, $Chan:ident) => (
|
||||
{
|
||||
let (port, chan) = comm::stream::<$Msg>();
|
||||
(port, $Chan::new(chan))
|
||||
}
|
||||
);
|
||||
)
|
||||
// Create the script port and channel.
|
||||
let (script_port, script_chan) = closure_stream!(ScriptMsg, ScriptChan);
|
||||
let (script_port, script_chan) = special_stream!(ScriptChan);
|
||||
let (layout_port, layout_chan) = special_stream!(LayoutChan);
|
||||
let (render_port, render_chan) = special_stream!(RenderChan);
|
||||
|
||||
// Create the layout port and channel.
|
||||
let (layout_port, layout_chan) = closure_stream!(layout_interface::Msg, LayoutChan);
|
||||
|
||||
let (render_port, render_chan) = comm::stream::<render_task::Msg>();
|
||||
let render_chan = RenderChan::new(render_chan);
|
||||
|
||||
RenderTask::create(render_port,
|
||||
RenderTask::create(id,
|
||||
render_port,
|
||||
compositor_chan.clone(),
|
||||
copy opts,
|
||||
constellation_chan.clone(),
|
||||
|
@ -94,6 +92,7 @@ impl Pipeline {
|
|||
layout_chan: layout_chan,
|
||||
render_chan: render_chan,
|
||||
url: None,
|
||||
navigation_type: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ use alert::{Alert, AlertMethods};
|
|||
use std::libc::c_int;
|
||||
use geom::point::Point2D;
|
||||
use geom::size::Size2D;
|
||||
use servo_msg::compositor::{IdleRenderState, RenderState, RenderingRenderState};
|
||||
use servo_msg::compositor::{FinishedLoading, Loading, PerformingLayout, ReadyState};
|
||||
use servo_msg::compositor_msg::{IdleRenderState, RenderState, RenderingRenderState};
|
||||
use servo_msg::compositor_msg::{FinishedLoading, Loading, PerformingLayout, ReadyState};
|
||||
use glut::glut::{ACTIVE_CTRL, ACTIVE_SHIFT, DOUBLE, HAVE_PRECISE_MOUSE_WHEEL, WindowHeight};
|
||||
use glut::glut::WindowWidth;
|
||||
use glut::glut;
|
||||
|
|
|
@ -36,7 +36,7 @@ extern mod core_text;
|
|||
|
||||
use compositing::{CompositorChan, CompositorTask};
|
||||
use constellation::Constellation;
|
||||
use servo_msg::constellation::{ExitMsg, LoadUrlMsg};
|
||||
use servo_msg::constellation_msg::{ExitMsg, LoadUrlMsg};
|
||||
|
||||
use gfx::opts;
|
||||
use servo_net::image_cache_task::ImageCacheTask;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use geom::point::Point2D;
|
||||
use geom::size::Size2D;
|
||||
use servo_msg::compositor::{ReadyState, RenderState};
|
||||
use servo_msg::compositor_msg::{ReadyState, RenderState};
|
||||
|
||||
pub enum WindowMouseEvent {
|
||||
WindowClickEvent(uint, Point2D<f32>),
|
||||
|
|
|
@ -49,7 +49,7 @@ pub enum ReadyState {
|
|||
/// submit them to be drawn to the display.
|
||||
pub trait RenderListener {
|
||||
fn get_gl_context(&self) -> AzGLContext;
|
||||
fn paint(&self, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>);
|
||||
fn paint(&self, id: uint, layer_buffer_set: LayerBufferSet, new_size: Size2D<uint>);
|
||||
fn set_render_state(&self, render_state: RenderState);
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,10 @@ pub trait ScriptListener : Clone {
|
|||
fn set_ready_state(&self, ReadyState);
|
||||
}
|
||||
|
||||
/// Signifies control of the compositor. Only the render task controlling
|
||||
/// the compositor token may send paint messages to the compositor
|
||||
/// Signifies to the renderer likely control of the compositor. Controlling the compositor token
|
||||
/// is necessary but not sufficient for the renderer to successfully send paint messages to the
|
||||
/// compositor. Only the render tasks controlling compositor tokens may send messages, and the
|
||||
/// compositor is guaranteed to only accept messages from one of those tasks at a time.
|
||||
pub struct CompositorToken {
|
||||
construction_restrictor: NonCopyable,
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
use std::comm::{Chan, SharedChan};
|
||||
use extra::net::url::Url;
|
||||
use compositor::CompositorToken;
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub struct ConstellationChan {
|
||||
|
@ -30,7 +29,13 @@ pub enum Msg {
|
|||
NavigateMsg(NavigationDirection),
|
||||
ExitMsg(Chan<()>),
|
||||
RendererReadyMsg(uint),
|
||||
TokenSurrenderMsg(~CompositorToken),
|
||||
CompositorAck(uint),
|
||||
}
|
||||
|
||||
/// Represents the two different ways to which a page can be navigated
|
||||
enum NavigationType {
|
||||
Load, // entered or clicked on a url
|
||||
Navigate, // browser forward/back buttons
|
||||
}
|
||||
|
||||
pub enum NavigationDirection {
|
|
@ -14,5 +14,5 @@ extern mod std;
|
|||
extern mod geom;
|
||||
extern mod extra;
|
||||
|
||||
pub mod compositor;
|
||||
pub mod constellation;
|
||||
pub mod compositor_msg;
|
||||
pub mod constellation_msg;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
/// The script task is the task that owns the DOM in memory, runs JavaScript, and spawns parsing
|
||||
/// and layout tasks.
|
||||
|
||||
use servo_msg::compositor::{ScriptListener, Loading, PerformingLayout};
|
||||
use servo_msg::compositor::FinishedLoading;
|
||||
use servo_msg::compositor_msg::{ScriptListener, Loading, PerformingLayout};
|
||||
use servo_msg::compositor_msg::FinishedLoading;
|
||||
use dom::bindings::utils::GlobalStaticData;
|
||||
use dom::document::Document;
|
||||
use dom::element::Element;
|
||||
|
@ -19,9 +19,9 @@ use layout_interface::{LayoutChan, MatchSelectorsDocumentDamage, QueryMsg, Reflo
|
|||
use layout_interface::{ReflowDocumentDamage, ReflowForDisplay, ReflowForScriptQuery, ReflowGoal};
|
||||
use layout_interface::ReflowMsg;
|
||||
use layout_interface;
|
||||
use servo_msg::constellation::{ConstellationChan, LoadUrlMsg, NavigationDirection};
|
||||
use servo_msg::constellation::RendererReadyMsg;
|
||||
use servo_msg::constellation;
|
||||
use servo_msg::constellation_msg::{ConstellationChan, LoadUrlMsg, NavigationDirection};
|
||||
use servo_msg::constellation_msg::RendererReadyMsg;
|
||||
use servo_msg::constellation_msg;
|
||||
|
||||
use std::cast::transmute;
|
||||
use std::cell::Cell;
|
||||
|
@ -337,7 +337,7 @@ impl ScriptTask {
|
|||
|
||||
/// Handles a navigate forward or backward message.
|
||||
fn handle_navigate_msg(&self, direction: NavigationDirection) {
|
||||
self.constellation_chan.send(constellation::NavigateMsg(direction));
|
||||
self.constellation_chan.send(constellation_msg::NavigateMsg(direction));
|
||||
}
|
||||
|
||||
/// Handles a request to exit the script task and shut down layout.
|
||||
|
@ -594,7 +594,7 @@ impl ScriptTask {
|
|||
Err(()) => {
|
||||
debug!(fmt!("layout query error"));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
MouseDownEvent(*) => {}
|
||||
MouseUpEvent(*) => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue