mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Merge pull request #2885 from arielb1/remove-compositing-layout
Break the compositing -> layout dependency
This commit is contained in:
commit
f07d999463
9 changed files with 174 additions and 118 deletions
24
Makefile.in
24
Makefile.in
|
@ -274,30 +274,38 @@ DONE_style = $(B)src/components/style/libstyle.dummy
|
||||||
|
|
||||||
DEPS_style = $(CRATE_style) $(SRC_style) $(DONE_SUBMODULES) $(DONE_util) $(DONE_macros)
|
DEPS_style = $(CRATE_style) $(SRC_style) $(DONE_SUBMODULES) $(DONE_util) $(DONE_macros)
|
||||||
|
|
||||||
RFLAGS_layout = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros
|
RFLAGS_layout_traits = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/style -L $(B)src/components/msg
|
||||||
|
|
||||||
|
SRC_layout_traits = $(call rwildcard,$(S)src/components/layout_traits/,*.rs)
|
||||||
|
CRATE_layout_traits = $(S)src/components/layout_traits/layout_traits.rs
|
||||||
|
DONE_layout_traits = $(B)src/components/layout_traits/liblayout_traits.dummy
|
||||||
|
|
||||||
|
DEPS_layout_traits = $(CRATE_layout_traits) $(SRC_layout_traits) $(DONE_script) $(DONE_msg) $(DONE_net) $(DONE_gfx) $(DONE_util)
|
||||||
|
|
||||||
|
RFLAGS_layout = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros -L$(B)src/components/layout_traits
|
||||||
|
|
||||||
SRC_layout = $(call rwildcard,$(S)src/components/layout/,*.rs) $(S)src/components/layout/css/user-agent.css
|
SRC_layout = $(call rwildcard,$(S)src/components/layout/,*.rs) $(S)src/components/layout/css/user-agent.css
|
||||||
CRATE_layout = $(S)src/components/layout/layout.rs
|
CRATE_layout = $(S)src/components/layout/layout.rs
|
||||||
DONE_layout = $(B)src/components/layout/liblayout.dummy
|
DONE_layout = $(B)src/components/layout/liblayout.dummy
|
||||||
|
|
||||||
DEPS_layout = $(CRATE_layout) $(SRC_layout) $(DONE_script) $(DONE_style) $(DONE_msg) $(DONE_macros) $(DONE_gfx) $(DONE_util)
|
DEPS_layout = $(CRATE_layout) $(SRC_layout) $(DONE_script) $(DONE_style) $(DONE_msg) $(DONE_macros) $(DONE_gfx) $(DONE_util) $(DONE_layout_traits)
|
||||||
|
|
||||||
RFLAGS_compositing = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/layout -L $(B)src/components/style -L $(B)src/components/msg
|
RFLAGS_compositing = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/layout_traits -L $(B)src/components/style -L $(B)src/components/msg
|
||||||
|
|
||||||
SRC_compositing = $(call rwildcard,$(S)src/components/compositing/,*.rs)
|
SRC_compositing = $(call rwildcard,$(S)src/components/compositing/,*.rs)
|
||||||
CRATE_compositing = $(S)src/components/compositing/compositing.rs
|
CRATE_compositing = $(S)src/components/compositing/compositing.rs
|
||||||
DONE_compositing = $(B)src/components/compositing/libcompositing.dummy
|
DONE_compositing = $(B)src/components/compositing/libcompositing.dummy
|
||||||
|
|
||||||
DEPS_compositing = $(CRATE_compositing) $(SRC_compositing) $(DONE_util) $(DONE_msg) $(DONE_gfx) $(DONE_script) $(DONE_layout) $(DONE_style)
|
DEPS_compositing = $(CRATE_compositing) $(SRC_compositing) $(DONE_util) $(DONE_msg) $(DONE_gfx) $(DONE_script) $(DONE_layout_traits) $(DONE_style)
|
||||||
|
|
||||||
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/layout -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros
|
RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/layout_traits -L $(B)src/components/layout -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L$(B)src/components/macros
|
||||||
|
|
||||||
SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs)
|
SRC_servo = $(call rwildcard,$(S)src/components/main/,*.rs)
|
||||||
CRATE_servo = $(S)src/components/main/servo.rs
|
CRATE_servo = $(S)src/components/main/servo.rs
|
||||||
|
|
||||||
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_macros) $(DONE_layout) $(DONE_compositing)
|
DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_util) $(DONE_gfx) $(DONE_script) $(DONE_net) $(DONE_msg) $(DONE_style) $(DONE_macros) $(DONE_layout) $(DONE_layout_traits) $(DONE_compositing)
|
||||||
|
|
||||||
SERVO_LIB_CRATES = macros util net msg gfx script style layout compositing
|
SERVO_LIB_CRATES = macros util net msg gfx script style layout layout_traits compositing
|
||||||
|
|
||||||
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
|
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
|
||||||
# and SERVO_LIB_CRATES
|
# and SERVO_LIB_CRATES
|
||||||
|
@ -364,7 +372,7 @@ servo: $(DEPS_servo)
|
||||||
@$(call E, compile: $@)
|
@$(call E, compile: $@)
|
||||||
$(Q)$(RUSTC) $(RFLAGS_servo) $< --crate-type bin,dylib,rlib
|
$(Q)$(RUSTC) $(RFLAGS_servo) $< --crate-type bin,dylib,rlib
|
||||||
|
|
||||||
RFLAGS_embedding = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/layout -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L $(B).. -L $(B)src/components/main -L $(B)src/components/macros -A non_camel_case_types -A unused_variable
|
RFLAGS_embedding = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/components/gfx -L $(B)src/components/util -L $(B)src/components/net -L $(B)src/components/script -L $(B)src/components/layout -L $(B)src/components/layout_traits -L $(B)src/components/compositing -L $(B)src/components/style -L $(B)src/components/msg -L $(B).. -L $(B)src/components/main -L $(B)src/components/macros -A non_camel_case_types -A unused_variable
|
||||||
|
|
||||||
ifeq ($(CFG_OSTYPE),apple-darwin)
|
ifeq ($(CFG_OSTYPE),apple-darwin)
|
||||||
RFLAGS_embedding += -C link-args="-Wl,-U,_tc_new -Wl,-U,_tc_newarray -Wl,-U,_tc_delete -Wl,-U,_tc_deletearray"
|
RFLAGS_embedding += -C link-args="-Wl,-U,_tc_new -Wl,-U,_tc_newarray -Wl,-U,_tc_delete -Wl,-U,_tc_deletearray"
|
||||||
|
|
1
configure
vendored
1
configure
vendored
|
@ -616,6 +616,7 @@ make_dir ${CFG_BUILD_DIR}src/components/msg
|
||||||
make_dir ${CFG_BUILD_DIR}src/components/net
|
make_dir ${CFG_BUILD_DIR}src/components/net
|
||||||
make_dir ${CFG_BUILD_DIR}src/components/gfx
|
make_dir ${CFG_BUILD_DIR}src/components/gfx
|
||||||
make_dir ${CFG_BUILD_DIR}src/components/layout
|
make_dir ${CFG_BUILD_DIR}src/components/layout
|
||||||
|
make_dir ${CFG_BUILD_DIR}src/components/layout_traits
|
||||||
make_dir ${CFG_BUILD_DIR}src/components/script
|
make_dir ${CFG_BUILD_DIR}src/components/script
|
||||||
make_dir ${CFG_BUILD_DIR}src/components/style
|
make_dir ${CFG_BUILD_DIR}src/components/style
|
||||||
make_dir ${CFG_BUILD_DIR}src/components/main
|
make_dir ${CFG_BUILD_DIR}src/components/main
|
||||||
|
|
|
@ -26,7 +26,7 @@ extern crate glfw;
|
||||||
#[cfg(target_os="android")]
|
#[cfg(target_os="android")]
|
||||||
extern crate glut;
|
extern crate glut;
|
||||||
extern crate layers;
|
extern crate layers;
|
||||||
extern crate layout;
|
extern crate layout_traits;
|
||||||
extern crate opengles;
|
extern crate opengles;
|
||||||
extern crate png;
|
extern crate png;
|
||||||
extern crate script;
|
extern crate script;
|
||||||
|
|
|
@ -10,6 +10,7 @@ use geom::size::TypedSize2D;
|
||||||
use gfx::render_task;
|
use gfx::render_task;
|
||||||
use libc;
|
use libc;
|
||||||
use pipeline::{Pipeline, CompositionPipeline};
|
use pipeline::{Pipeline, CompositionPipeline};
|
||||||
|
use layout_traits::LayoutTaskFactory;
|
||||||
use script::script_task::{ResizeMsg, ResizeInactiveMsg, ExitPipelineMsg};
|
use script::script_task::{ResizeMsg, ResizeInactiveMsg, ExitPipelineMsg};
|
||||||
use script::layout_interface;
|
use script::layout_interface;
|
||||||
use script::layout_interface::LayoutChan;
|
use script::layout_interface::LayoutChan;
|
||||||
|
@ -31,13 +32,14 @@ use servo_util::time::TimeProfilerChan;
|
||||||
use servo_util::url::parse_url;
|
use servo_util::url::parse_url;
|
||||||
use servo_util::task::spawn_named;
|
use servo_util::task::spawn_named;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
use std::kinds::marker;
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
/// Maintains the pipelines and navigation context and grants permission to composite
|
/// Maintains the pipelines and navigation context and grants permission to composite
|
||||||
pub struct Constellation {
|
pub struct Constellation<LTF> {
|
||||||
pub chan: ConstellationChan,
|
pub chan: ConstellationChan,
|
||||||
pub request_port: Receiver<Msg>,
|
pub request_port: Receiver<Msg>,
|
||||||
pub compositor_chan: CompositorChan,
|
pub compositor_chan: CompositorChan,
|
||||||
|
@ -49,6 +51,7 @@ pub struct Constellation {
|
||||||
next_pipeline_id: PipelineId,
|
next_pipeline_id: PipelineId,
|
||||||
pending_frames: Vec<FrameChange>,
|
pending_frames: Vec<FrameChange>,
|
||||||
pending_sizes: HashMap<(PipelineId, SubpageId), TypedRect<PagePx, f32>>,
|
pending_sizes: HashMap<(PipelineId, SubpageId), TypedRect<PagePx, f32>>,
|
||||||
|
layout_task_factory: marker::CovariantType<LTF>,
|
||||||
pub time_profiler_chan: TimeProfilerChan,
|
pub time_profiler_chan: TimeProfilerChan,
|
||||||
pub window_size: WindowSizeData,
|
pub window_size: WindowSizeData,
|
||||||
pub opts: Opts,
|
pub opts: Opts,
|
||||||
|
@ -240,7 +243,7 @@ impl NavigationContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Constellation {
|
impl<LTF: LayoutTaskFactory> Constellation<LTF> {
|
||||||
pub fn start(compositor_chan: CompositorChan,
|
pub fn start(compositor_chan: CompositorChan,
|
||||||
opts: &Opts,
|
opts: &Opts,
|
||||||
resource_task: ResourceTask,
|
resource_task: ResourceTask,
|
||||||
|
@ -252,7 +255,7 @@ impl Constellation {
|
||||||
let constellation_chan_clone = constellation_chan.clone();
|
let constellation_chan_clone = constellation_chan.clone();
|
||||||
let opts_clone = opts.clone();
|
let opts_clone = opts.clone();
|
||||||
spawn_named("Constellation", proc() {
|
spawn_named("Constellation", proc() {
|
||||||
let mut constellation = Constellation {
|
let mut constellation : Constellation<LTF> = Constellation {
|
||||||
chan: constellation_chan_clone,
|
chan: constellation_chan_clone,
|
||||||
request_port: constellation_port,
|
request_port: constellation_port,
|
||||||
compositor_chan: compositor_chan,
|
compositor_chan: compositor_chan,
|
||||||
|
@ -264,6 +267,7 @@ impl Constellation {
|
||||||
next_pipeline_id: PipelineId(0),
|
next_pipeline_id: PipelineId(0),
|
||||||
pending_frames: vec!(),
|
pending_frames: vec!(),
|
||||||
pending_sizes: HashMap::new(),
|
pending_sizes: HashMap::new(),
|
||||||
|
layout_task_factory: marker::CovariantType,
|
||||||
time_profiler_chan: time_profiler_chan,
|
time_profiler_chan: time_profiler_chan,
|
||||||
window_size: WindowSizeData {
|
window_size: WindowSizeData {
|
||||||
visible_viewport: TypedSize2D(800_f32, 600_f32),
|
visible_viewport: TypedSize2D(800_f32, 600_f32),
|
||||||
|
@ -286,6 +290,26 @@ impl Constellation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Helper function for creating a pipeline
|
||||||
|
fn new_pipeline(&self,
|
||||||
|
id: PipelineId,
|
||||||
|
subpage_id: Option<SubpageId>,
|
||||||
|
url: Url)
|
||||||
|
-> Pipeline {
|
||||||
|
Pipeline::create::<LTF>(id,
|
||||||
|
subpage_id,
|
||||||
|
self.chan.clone(),
|
||||||
|
self.compositor_chan.clone(),
|
||||||
|
self.image_cache_task.clone(),
|
||||||
|
self.font_cache_task.clone(),
|
||||||
|
self.resource_task.clone(),
|
||||||
|
self.time_profiler_chan.clone(),
|
||||||
|
self.window_size,
|
||||||
|
self.opts.clone(),
|
||||||
|
url)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Helper function for getting a unique pipeline Id
|
/// Helper function for getting a unique pipeline Id
|
||||||
fn get_next_pipeline_id(&mut self) -> PipelineId {
|
fn get_next_pipeline_id(&mut self) -> PipelineId {
|
||||||
let id = self.next_pipeline_id;
|
let id = self.next_pipeline_id;
|
||||||
|
@ -422,17 +446,7 @@ impl Constellation {
|
||||||
debug!("creating replacement pipeline for about:failure");
|
debug!("creating replacement pipeline for about:failure");
|
||||||
|
|
||||||
let new_id = self.get_next_pipeline_id();
|
let new_id = self.get_next_pipeline_id();
|
||||||
let pipeline = Pipeline::create(new_id,
|
let pipeline = self.new_pipeline(new_id, subpage_id, parse_url("about:failure", None));
|
||||||
subpage_id,
|
|
||||||
self.chan.clone(),
|
|
||||||
self.compositor_chan.clone(),
|
|
||||||
self.image_cache_task.clone(),
|
|
||||||
self.font_cache_task.clone(),
|
|
||||||
self.resource_task.clone(),
|
|
||||||
self.time_profiler_chan.clone(),
|
|
||||||
self.window_size,
|
|
||||||
self.opts.clone(),
|
|
||||||
parse_url("about:failure", None));
|
|
||||||
pipeline.load();
|
pipeline.load();
|
||||||
|
|
||||||
let pipeline_wrapped = Rc::new(pipeline);
|
let pipeline_wrapped = Rc::new(pipeline);
|
||||||
|
@ -450,17 +464,8 @@ impl Constellation {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_init_load(&mut self, url: Url) {
|
fn handle_init_load(&mut self, url: Url) {
|
||||||
let pipeline = Pipeline::create(self.get_next_pipeline_id(),
|
let next_pipeline_id = self.get_next_pipeline_id();
|
||||||
None,
|
let pipeline = self.new_pipeline(next_pipeline_id, None, url);
|
||||||
self.chan.clone(),
|
|
||||||
self.compositor_chan.clone(),
|
|
||||||
self.image_cache_task.clone(),
|
|
||||||
self.font_cache_task.clone(),
|
|
||||||
self.resource_task.clone(),
|
|
||||||
self.time_profiler_chan.clone(),
|
|
||||||
self.window_size,
|
|
||||||
self.opts.clone(),
|
|
||||||
url);
|
|
||||||
pipeline.load();
|
pipeline.load();
|
||||||
let pipeline_wrapped = Rc::new(pipeline);
|
let pipeline_wrapped = Rc::new(pipeline);
|
||||||
|
|
||||||
|
@ -577,30 +582,20 @@ impl Constellation {
|
||||||
let pipeline = if same_script {
|
let pipeline = if same_script {
|
||||||
debug!("Constellation: loading same-origin iframe at {:?}", url);
|
debug!("Constellation: loading same-origin iframe at {:?}", url);
|
||||||
// Reuse the script task if same-origin url's
|
// Reuse the script task if same-origin url's
|
||||||
Pipeline::with_script(next_pipeline_id,
|
Pipeline::with_script::<LTF>(next_pipeline_id,
|
||||||
subpage_id,
|
subpage_id,
|
||||||
self.chan.clone(),
|
self.chan.clone(),
|
||||||
self.compositor_chan.clone(),
|
self.compositor_chan.clone(),
|
||||||
self.image_cache_task.clone(),
|
self.image_cache_task.clone(),
|
||||||
self.font_cache_task.clone(),
|
self.font_cache_task.clone(),
|
||||||
self.time_profiler_chan.clone(),
|
self.time_profiler_chan.clone(),
|
||||||
self.opts.clone(),
|
self.opts.clone(),
|
||||||
source_pipeline.clone(),
|
source_pipeline.clone(),
|
||||||
url)
|
url)
|
||||||
} else {
|
} else {
|
||||||
debug!("Constellation: loading cross-origin iframe at {:?}", url);
|
debug!("Constellation: loading cross-origin iframe at {:?}", url);
|
||||||
// Create a new script task if not same-origin url's
|
// Create a new script task if not same-origin url's
|
||||||
Pipeline::create(next_pipeline_id,
|
self.new_pipeline(next_pipeline_id, Some(subpage_id), url)
|
||||||
Some(subpage_id),
|
|
||||||
self.chan.clone(),
|
|
||||||
self.compositor_chan.clone(),
|
|
||||||
self.image_cache_task.clone(),
|
|
||||||
self.font_cache_task.clone(),
|
|
||||||
self.resource_task.clone(),
|
|
||||||
self.time_profiler_chan.clone(),
|
|
||||||
self.window_size,
|
|
||||||
self.opts.clone(),
|
|
||||||
url)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!("Constellation: sending load msg to pipeline {:?}", pipeline.id);
|
debug!("Constellation: sending load msg to pipeline {:?}", pipeline.id);
|
||||||
|
@ -647,18 +642,7 @@ impl Constellation {
|
||||||
let subpage_id = source_frame.pipeline.subpage_id;
|
let subpage_id = source_frame.pipeline.subpage_id;
|
||||||
let next_pipeline_id = self.get_next_pipeline_id();
|
let next_pipeline_id = self.get_next_pipeline_id();
|
||||||
|
|
||||||
let pipeline = Pipeline::create(next_pipeline_id,
|
let pipeline = self.new_pipeline(next_pipeline_id, subpage_id, url);
|
||||||
subpage_id,
|
|
||||||
self.chan.clone(),
|
|
||||||
self.compositor_chan.clone(),
|
|
||||||
self.image_cache_task.clone(),
|
|
||||||
self.font_cache_task.clone(),
|
|
||||||
self.resource_task.clone(),
|
|
||||||
self.time_profiler_chan.clone(),
|
|
||||||
self.window_size,
|
|
||||||
self.opts.clone(),
|
|
||||||
url);
|
|
||||||
|
|
||||||
pipeline.load();
|
pipeline.load();
|
||||||
let pipeline_wrapped = Rc::new(pipeline);
|
let pipeline_wrapped = Rc::new(pipeline);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use CompositorChan;
|
use CompositorChan;
|
||||||
use layout::layout_task::LayoutTask;
|
use layout_traits::LayoutTaskFactory;
|
||||||
|
|
||||||
use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
|
use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
|
||||||
use gfx::render_task::{RenderChan, RenderTask};
|
use gfx::render_task::{RenderChan, RenderTask};
|
||||||
|
@ -45,17 +45,18 @@ pub struct CompositionPipeline {
|
||||||
impl Pipeline {
|
impl Pipeline {
|
||||||
/// Starts a render task, layout task, and script task. Returns the channels wrapped in a
|
/// Starts a render task, layout task, and script task. Returns the channels wrapped in a
|
||||||
/// struct.
|
/// struct.
|
||||||
pub fn with_script(id: PipelineId,
|
pub fn with_script<LTF:LayoutTaskFactory>(
|
||||||
subpage_id: SubpageId,
|
id: PipelineId,
|
||||||
constellation_chan: ConstellationChan,
|
subpage_id: SubpageId,
|
||||||
compositor_chan: CompositorChan,
|
constellation_chan: ConstellationChan,
|
||||||
image_cache_task: ImageCacheTask,
|
compositor_chan: CompositorChan,
|
||||||
font_cache_task: FontCacheTask,
|
image_cache_task: ImageCacheTask,
|
||||||
time_profiler_chan: TimeProfilerChan,
|
font_cache_task: FontCacheTask,
|
||||||
opts: Opts,
|
time_profiler_chan: TimeProfilerChan,
|
||||||
script_pipeline: Rc<Pipeline>,
|
opts: Opts,
|
||||||
url: Url)
|
script_pipeline: Rc<Pipeline>,
|
||||||
-> Pipeline {
|
url: Url)
|
||||||
|
-> Pipeline {
|
||||||
let (layout_port, layout_chan) = LayoutChan::new();
|
let (layout_port, layout_chan) = LayoutChan::new();
|
||||||
let (render_port, render_chan) = RenderChan::new();
|
let (render_port, render_chan) = RenderChan::new();
|
||||||
let (render_shutdown_chan, render_shutdown_port) = channel();
|
let (render_shutdown_chan, render_shutdown_port) = channel();
|
||||||
|
@ -76,18 +77,19 @@ impl Pipeline {
|
||||||
time_profiler_chan.clone(),
|
time_profiler_chan.clone(),
|
||||||
render_shutdown_chan);
|
render_shutdown_chan);
|
||||||
|
|
||||||
LayoutTask::create(id,
|
LayoutTaskFactory::create(None::<&mut LTF>,
|
||||||
layout_port,
|
id,
|
||||||
layout_chan.clone(),
|
layout_port,
|
||||||
constellation_chan,
|
layout_chan.clone(),
|
||||||
failure,
|
constellation_chan,
|
||||||
script_pipeline.script_chan.clone(),
|
failure,
|
||||||
render_chan.clone(),
|
script_pipeline.script_chan.clone(),
|
||||||
image_cache_task.clone(),
|
render_chan.clone(),
|
||||||
font_cache_task.clone(),
|
image_cache_task.clone(),
|
||||||
opts.clone(),
|
font_cache_task.clone(),
|
||||||
time_profiler_chan,
|
opts.clone(),
|
||||||
layout_shutdown_chan);
|
time_profiler_chan,
|
||||||
|
layout_shutdown_chan);
|
||||||
|
|
||||||
let new_layout_info = NewLayoutInfo {
|
let new_layout_info = NewLayoutInfo {
|
||||||
old_pipeline_id: script_pipeline.id.clone(),
|
old_pipeline_id: script_pipeline.id.clone(),
|
||||||
|
@ -109,18 +111,19 @@ impl Pipeline {
|
||||||
url)
|
url)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create(id: PipelineId,
|
pub fn create<LTF:LayoutTaskFactory>(
|
||||||
subpage_id: Option<SubpageId>,
|
id: PipelineId,
|
||||||
constellation_chan: ConstellationChan,
|
subpage_id: Option<SubpageId>,
|
||||||
compositor_chan: CompositorChan,
|
constellation_chan: ConstellationChan,
|
||||||
image_cache_task: ImageCacheTask,
|
compositor_chan: CompositorChan,
|
||||||
font_cache_task: FontCacheTask,
|
image_cache_task: ImageCacheTask,
|
||||||
resource_task: ResourceTask,
|
font_cache_task: FontCacheTask,
|
||||||
time_profiler_chan: TimeProfilerChan,
|
resource_task: ResourceTask,
|
||||||
window_size: WindowSizeData,
|
time_profiler_chan: TimeProfilerChan,
|
||||||
opts: Opts,
|
window_size: WindowSizeData,
|
||||||
url: Url)
|
opts: Opts,
|
||||||
-> Pipeline {
|
url: Url)
|
||||||
|
-> Pipeline {
|
||||||
let (script_port, script_chan) = ScriptChan::new();
|
let (script_port, script_chan) = ScriptChan::new();
|
||||||
let (layout_port, layout_chan) = LayoutChan::new();
|
let (layout_port, layout_chan) = LayoutChan::new();
|
||||||
let (render_port, render_chan) = RenderChan::new();
|
let (render_port, render_chan) = RenderChan::new();
|
||||||
|
@ -161,18 +164,19 @@ impl Pipeline {
|
||||||
time_profiler_chan.clone(),
|
time_profiler_chan.clone(),
|
||||||
render_shutdown_chan);
|
render_shutdown_chan);
|
||||||
|
|
||||||
LayoutTask::create(id,
|
LayoutTaskFactory::create(None::<&mut LTF>,
|
||||||
layout_port,
|
id,
|
||||||
layout_chan.clone(),
|
layout_port,
|
||||||
constellation_chan,
|
layout_chan.clone(),
|
||||||
failure,
|
constellation_chan,
|
||||||
script_chan.clone(),
|
failure,
|
||||||
render_chan.clone(),
|
script_chan.clone(),
|
||||||
image_cache_task,
|
render_chan.clone(),
|
||||||
font_cache_task,
|
image_cache_task,
|
||||||
opts.clone(),
|
font_cache_task,
|
||||||
time_profiler_chan,
|
opts.clone(),
|
||||||
layout_shutdown_chan);
|
time_profiler_chan,
|
||||||
|
layout_shutdown_chan);
|
||||||
|
|
||||||
pipeline
|
pipeline
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ extern crate debug;
|
||||||
|
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate gfx;
|
extern crate gfx;
|
||||||
|
extern crate layout_traits;
|
||||||
extern crate script;
|
extern crate script;
|
||||||
extern crate style;
|
extern crate style;
|
||||||
#[phase(plugin)]
|
#[phase(plugin)]
|
||||||
|
|
|
@ -30,6 +30,7 @@ use gfx::display_list::{DisplayItemIterator, DisplayList, OpaqueNode};
|
||||||
use gfx::font_context::FontContext;
|
use gfx::font_context::FontContext;
|
||||||
use gfx::render_task::{RenderMsg, RenderChan, RenderLayer};
|
use gfx::render_task::{RenderMsg, RenderChan, RenderLayer};
|
||||||
use gfx::{render_task, color};
|
use gfx::{render_task, color};
|
||||||
|
use layout_traits::LayoutTaskFactory;
|
||||||
use script::dom::bindings::js::JS;
|
use script::dom::bindings::js::JS;
|
||||||
use script::dom::event::ReflowEvent;
|
use script::dom::event::ReflowEvent;
|
||||||
use script::dom::node::{ElementNodeTypeId, LayoutDataRef, Node};
|
use script::dom::node::{ElementNodeTypeId, LayoutDataRef, Node};
|
||||||
|
@ -272,9 +273,10 @@ impl ImageResponder for LayoutImageResponder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LayoutTask {
|
impl LayoutTaskFactory for LayoutTask {
|
||||||
/// Spawns a new layout task.
|
/// Spawns a new layout task.
|
||||||
pub fn create(id: PipelineId,
|
fn create(_phantom: Option<&mut LayoutTask>,
|
||||||
|
id: PipelineId,
|
||||||
port: Receiver<Msg>,
|
port: Receiver<Msg>,
|
||||||
chan: LayoutChan,
|
chan: LayoutChan,
|
||||||
constellation_chan: ConstellationChan,
|
constellation_chan: ConstellationChan,
|
||||||
|
@ -306,7 +308,9 @@ impl LayoutTask {
|
||||||
shutdown_chan.send(());
|
shutdown_chan.send(());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl LayoutTask {
|
||||||
/// Creates a new `LayoutTask` structure.
|
/// Creates a new `LayoutTask` structure.
|
||||||
fn new(id: PipelineId,
|
fn new(id: PipelineId,
|
||||||
port: Receiver<Msg>,
|
port: Receiver<Msg>,
|
||||||
|
|
52
src/components/layout_traits/layout_traits.rs
Normal file
52
src/components/layout_traits/layout_traits.rs
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* 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/. */
|
||||||
|
|
||||||
|
#![crate_id = "github.com/mozilla/servo#layout_traits:0.1"]
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
#![crate_type = "dylib"]
|
||||||
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
#![comment = "The Servo Parallel Browser Project"]
|
||||||
|
#![license = "MPL"]
|
||||||
|
|
||||||
|
extern crate gfx;
|
||||||
|
extern crate script;
|
||||||
|
extern crate servo_msg = "msg";
|
||||||
|
extern crate servo_net = "net";
|
||||||
|
extern crate servo_util = "util";
|
||||||
|
|
||||||
|
// This module contains traits in layout used generically
|
||||||
|
// in the rest of Servo.
|
||||||
|
// The traits are here instead of in layout so
|
||||||
|
// that these modules won't have to depend on layout.
|
||||||
|
|
||||||
|
use gfx::font_cache_task::FontCacheTask;
|
||||||
|
use gfx::render_task::RenderChan;
|
||||||
|
use servo_msg::constellation_msg::{ConstellationChan, PipelineId};
|
||||||
|
use servo_msg::constellation_msg::Failure;
|
||||||
|
use servo_net::image_cache_task::ImageCacheTask;
|
||||||
|
use servo_util::opts::Opts;
|
||||||
|
use servo_util::time::TimeProfilerChan;
|
||||||
|
use script::layout_interface::{LayoutChan, Msg};
|
||||||
|
use script::script_task::ScriptChan;
|
||||||
|
use std::comm::{Sender, Receiver};
|
||||||
|
|
||||||
|
// A static method creating a layout task
|
||||||
|
// Here to remove the compositor -> layout dependency
|
||||||
|
pub trait LayoutTaskFactory {
|
||||||
|
// FIXME: use a proper static method
|
||||||
|
fn create(_phantom: Option<&mut Self>,
|
||||||
|
id: PipelineId,
|
||||||
|
port: Receiver<Msg>,
|
||||||
|
chan: LayoutChan,
|
||||||
|
constellation_chan: ConstellationChan,
|
||||||
|
failure_msg: Failure,
|
||||||
|
script_chan: ScriptChan,
|
||||||
|
render_chan: RenderChan,
|
||||||
|
img_cache_task: ImageCacheTask,
|
||||||
|
font_cache_task: FontCacheTask,
|
||||||
|
opts: Opts,
|
||||||
|
time_profiler_chan: TimeProfilerChan,
|
||||||
|
shutdown_chan: Sender<()>);
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ extern crate servo_msg = "msg";
|
||||||
#[phase(plugin, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate servo_util = "util";
|
extern crate servo_util = "util";
|
||||||
extern crate script;
|
extern crate script;
|
||||||
|
extern crate layout;
|
||||||
extern crate green;
|
extern crate green;
|
||||||
extern crate gfx;
|
extern crate gfx;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
@ -125,7 +126,8 @@ pub fn run(opts: opts::Opts) {
|
||||||
ImageCacheTask::new(resource_task.clone())
|
ImageCacheTask::new(resource_task.clone())
|
||||||
};
|
};
|
||||||
let font_cache_task = FontCacheTask::new();
|
let font_cache_task = FontCacheTask::new();
|
||||||
let constellation_chan = Constellation::start(compositor_chan,
|
let constellation_chan = Constellation::<layout::layout_task::LayoutTask>::start(
|
||||||
|
compositor_chan,
|
||||||
opts,
|
opts,
|
||||||
resource_task,
|
resource_task,
|
||||||
image_cache_task,
|
image_cache_task,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue