mirror of
https://github.com/servo/servo.git
synced 2025-06-25 09:34:32 +01:00
structural changes to support Iframes
This commit is contained in:
parent
eaa20edcd7
commit
e9888b299c
30 changed files with 1416 additions and 835 deletions
|
@ -5,22 +5,26 @@
|
|||
use extra::net::url::Url;
|
||||
use compositing::CompositorChan;
|
||||
use gfx::render_task::{RenderChan, RenderTask};
|
||||
use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
|
||||
use gfx::render_task;
|
||||
use gfx::opts::Opts;
|
||||
use layout::layout_task::LayoutTask;
|
||||
use script::layout_interface::LayoutChan;
|
||||
use script::script_task::LoadMsg;
|
||||
use servo_msg::constellation_msg::{ConstellationChan, NavigationType};
|
||||
use script::script_task::{ScriptTask, ScriptChan};
|
||||
use script::script_task::{ExecuteMsg, LoadMsg};
|
||||
use servo_msg::constellation_msg::{ConstellationChan, NavigationType, PipelineId};
|
||||
use script::script_task::{AttachLayoutMsg, NewLayoutInfo, 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 geom::size::Size2D;
|
||||
use extra::future::Future;
|
||||
use std::comm;
|
||||
|
||||
/// A uniquely-identifiable pipeline of stript task, layout task, and render task.
|
||||
#[deriving(Clone)]
|
||||
pub struct Pipeline {
|
||||
id: uint,
|
||||
id: PipelineId,
|
||||
script_chan: ScriptChan,
|
||||
layout_chan: LayoutChan,
|
||||
render_chan: RenderChan,
|
||||
|
@ -31,15 +35,15 @@ pub struct Pipeline {
|
|||
|
||||
impl Pipeline {
|
||||
/// Starts a render task, layout task, and script task. Returns the channels wrapped in a struct.
|
||||
pub fn create(id: uint,
|
||||
constellation_chan: ConstellationChan,
|
||||
compositor_chan: CompositorChan,
|
||||
image_cache_task: ImageCacheTask,
|
||||
resource_task: ResourceTask,
|
||||
profiler_chan: ProfilerChan,
|
||||
opts: Opts) -> Pipeline {
|
||||
pub fn with_script(id: PipelineId,
|
||||
constellation_chan: ConstellationChan,
|
||||
compositor_chan: CompositorChan,
|
||||
image_cache_task: ImageCacheTask,
|
||||
profiler_chan: ProfilerChan,
|
||||
opts: Opts,
|
||||
script_pipeline: &Pipeline,
|
||||
size_future: Future<Size2D<uint>>) -> Pipeline {
|
||||
|
||||
let (script_port, script_chan) = special_stream!(ScriptChan);
|
||||
let (layout_port, layout_chan) = special_stream!(LayoutChan);
|
||||
let (render_port, render_chan) = special_stream!(RenderChan);
|
||||
|
||||
|
@ -49,30 +53,76 @@ impl Pipeline {
|
|||
copy opts,
|
||||
profiler_chan.clone());
|
||||
|
||||
LayoutTask::create(layout_port,
|
||||
script_chan.clone(),
|
||||
LayoutTask::create(id,
|
||||
layout_port,
|
||||
constellation_chan,
|
||||
script_pipeline.script_chan.clone(),
|
||||
render_chan.clone(),
|
||||
image_cache_task.clone(),
|
||||
copy opts,
|
||||
profiler_chan);
|
||||
|
||||
let new_layout_info = NewLayoutInfo {
|
||||
old_id: script_pipeline.id.clone(),
|
||||
new_id: id,
|
||||
layout_chan: layout_chan.clone(),
|
||||
size_future: size_future,
|
||||
};
|
||||
|
||||
script_pipeline.script_chan.send(AttachLayoutMsg(new_layout_info));
|
||||
|
||||
Pipeline::new(id,
|
||||
script_pipeline.script_chan.clone(),
|
||||
layout_chan,
|
||||
render_chan)
|
||||
|
||||
}
|
||||
|
||||
pub fn create(id: PipelineId,
|
||||
constellation_chan: ConstellationChan,
|
||||
compositor_chan: CompositorChan,
|
||||
image_cache_task: ImageCacheTask,
|
||||
resource_task: ResourceTask,
|
||||
profiler_chan: ProfilerChan,
|
||||
opts: Opts,
|
||||
size: Future<Size2D<uint>>) -> Pipeline {
|
||||
|
||||
let (script_port, script_chan) = special_stream!(ScriptChan);
|
||||
let (layout_port, layout_chan) = special_stream!(LayoutChan);
|
||||
let (render_port, render_chan) = special_stream!(RenderChan);
|
||||
|
||||
ScriptTask::create(id,
|
||||
compositor_chan.clone(),
|
||||
layout_chan.clone(),
|
||||
script_port,
|
||||
script_chan.clone(),
|
||||
constellation_chan,
|
||||
constellation_chan.clone(),
|
||||
resource_task,
|
||||
image_cache_task,
|
||||
compositor_chan.get_size());
|
||||
image_cache_task.clone(),
|
||||
size);
|
||||
|
||||
|
||||
RenderTask::create(id,
|
||||
render_port,
|
||||
compositor_chan.clone(),
|
||||
copy opts,
|
||||
profiler_chan.clone());
|
||||
|
||||
LayoutTask::create(id,
|
||||
layout_port,
|
||||
constellation_chan,
|
||||
script_chan.clone(),
|
||||
render_chan.clone(),
|
||||
image_cache_task,
|
||||
copy opts,
|
||||
profiler_chan);
|
||||
Pipeline::new(id,
|
||||
script_chan,
|
||||
layout_chan,
|
||||
render_chan)
|
||||
}
|
||||
|
||||
pub fn new(id: uint,
|
||||
pub fn new(id: PipelineId,
|
||||
script_chan: ScriptChan,
|
||||
layout_chan: LayoutChan,
|
||||
render_chan: RenderChan)
|
||||
|
@ -89,12 +139,25 @@ impl Pipeline {
|
|||
|
||||
pub fn load(&mut self, url: Url) {
|
||||
self.url = Some(url.clone());
|
||||
self.script_chan.send(LoadMsg(url));
|
||||
self.script_chan.send(LoadMsg(self.id, url));
|
||||
}
|
||||
|
||||
pub fn execute(&mut self, url: Url) {
|
||||
self.url = Some(url.clone());
|
||||
self.script_chan.send(ExecuteMsg(self.id, url));
|
||||
}
|
||||
|
||||
pub fn grant_paint_permission(&self) {
|
||||
self.render_chan.send(PaintPermissionGranted);
|
||||
}
|
||||
|
||||
pub fn revoke_paint_permission(&self) {
|
||||
self.render_chan.send(PaintPermissionRevoked);
|
||||
}
|
||||
|
||||
pub fn reload(&self) {
|
||||
for self.url.iter().advance |url| {
|
||||
self.script_chan.send(LoadMsg(url.clone()));
|
||||
self.script_chan.send(LoadMsg(self.id, url.clone()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue