Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the DOM and layout into separate crates. #474

Merged
merged 9 commits into from May 30, 2013

Fix merge fallout.

  • Loading branch information
pcwalton committed May 28, 2013
commit 83e1bd81e81bc4a121b182f9ac1b41fd22af97a3
@@ -34,7 +34,10 @@ pub struct RenderTask {
}

impl RenderTask {
pub fn new<C:Compositor + Owned>(compositor: C, opts: Opts) -> RenderTask {
pub fn new<C:Compositor + Owned>(compositor: C,
opts: Opts,
profiler_chan: ProfilerChan)
-> RenderTask {
let compositor_cell = Cell(compositor);
let opts_cell = Cell(opts);
let (port, chan) = comm::stream();
@@ -48,14 +51,21 @@ impl RenderTask {
let n_threads = opts.n_render_threads;
let new_opts_cell = Cell(opts);

let profiler_chan = profiler_chan.clone();
let profiler_chan_copy = profiler_chan.clone();

let thread_pool = do TaskPool::new(n_threads, Some(SingleThreaded)) {
let opts_cell = Cell(new_opts_cell.with_ref(|o| copy *o));
let profiler_chan = Cell(profiler_chan.clone());

let f: ~fn(uint) -> ThreadRenderContext = |thread_index| {
let opts = opts_cell.with_ref(|opts| copy *opts);

ThreadRenderContext {
thread_index: thread_index,
font_ctx: @mut FontContext::new(opts.render_backend, false),
font_ctx: @mut FontContext::new(opts.render_backend,
false,
profiler_chan.take()),
opts: opts,
}
};
@@ -67,7 +77,8 @@ impl RenderTask {
port: port.take(),
compositor: compositor,
thread_pool: thread_pool,
opts: opts_cell.take()
opts: opts_cell.take(),
profiler_chan: profiler_chan_copy,
};

renderer.start();
@@ -91,7 +102,9 @@ priv struct Renderer<C> {
compositor: C,
thread_pool: TaskPool<ThreadRenderContext>,
opts: Opts,
prof_chan: ProfilerChan,

/// A channel to the profiler.
profiler_chan: ProfilerChan,
}

impl<C: Compositor + Owned> Renderer<C> {
@@ -112,8 +125,11 @@ impl<C: Compositor + Owned> Renderer<C> {
fn render(&mut self, render_layer: RenderLayer) {
debug!("renderer: rendering");
do time("rendering") {
let layer_buffer_set = do render_layers(&render_layer, &self.opts)
|render_layer_ref, layer_buffer, buffer_chan| {
let layer_buffer_set = do render_layers(&render_layer,
&self.opts,
self.profiler_chan.clone()) |render_layer_ref,
layer_buffer,
buffer_chan| {
let layer_buffer_cell = Cell(layer_buffer);
do self.thread_pool.execute |thread_render_context| {
do layer_buffer_cell.with_ref |layer_buffer| {
@@ -190,7 +190,7 @@ fn run_main_loop(port: Port<Msg>,
};

do window.set_composite_callback {
do profile(time::CompositingCategory, prof_chan.clone()) {
do profile(time::CompositingCategory, profiler_chan.clone()) {
debug!("compositor: compositing");
// Adjust the layer dimensions as necessary to correspond to the size of the window.
scene.size = window.size();
@@ -17,11 +17,9 @@ use gfx::render_task;
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task;
use std::net::url::Url;

use servo_util::time::{ProfilerChan, ProfilerPort, ProfilerTask};
use servo_util::time;
use servo_util::time::ProfilerChan;
use servo_util::time::ProfilerPort;
use std::net::url::Url;

pub type EngineTask = Chan<Msg>;

@@ -38,7 +36,7 @@ pub struct Engine {
image_cache_task: ImageCacheTask,
layout_task: LayoutTask,
script_task: ScriptTask,
profiler_task: time::ProfilerTask,
profiler_task: ProfilerTask,
}

impl Engine {
@@ -60,6 +58,8 @@ impl Engine {
opts.with_ref(|o| copy *o),
profiler_chan.clone());

let profiler_task = ProfilerTask::new(profiler_port.take(), profiler_chan.clone());

let opts = opts.take();
let layout_task = LayoutTask(render_task.clone(),
image_cache_task.clone(),
@@ -760,7 +760,7 @@ pub impl RenderBox {
fn text_decoration(&self) -> CSSTextDecoration {
/// Computes the propagated value of text-decoration, as specified in CSS 2.1 § 16.3.1
/// TODO: make sure this works with anonymous box generation.
fn get_propagated_text_decoration(element: AbstractNode) -> CSSTextDecoration {
fn get_propagated_text_decoration(element: AbstractNode<LayoutView>) -> CSSTextDecoration {
//Skip over non-element nodes in the DOM
if(!element.is_element()){
return match element.parent_node() {
@@ -155,8 +155,8 @@ fn run(opts: &Opts) {
script_chan,
resource_task,
image_cache_task,
prof_port,
prof_chan);
profiler_port,
profiler_chan);

// Send the URL command to the engine task.
for opts.urls.each |filename| {
@@ -35,7 +35,7 @@ def do_license_check(name, contents):
"src/support", # Upstream
"src/platform", # Upstream
"src/compiler", # Upstream
"src/components/servo/dom/bindings/codegen", # Generated and upstream code combined with our own. Could use cleanup
"src/components/main/dom/bindings/codegen", # Generated and upstream code combined with our own. Could use cleanup
]

def should_check(name):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.