mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Rename content to content_task
This commit is contained in:
parent
65c6ce3dda
commit
9d42568414
6 changed files with 23 additions and 20 deletions
|
@ -3,10 +3,9 @@
|
||||||
tasks.
|
tasks.
|
||||||
"]
|
"]
|
||||||
|
|
||||||
export Content;
|
export ContentTask;
|
||||||
export ControlMsg, ExecuteMsg, ParseMsg, ExitMsg;
|
export ControlMsg, ExecuteMsg, ParseMsg, ExitMsg;
|
||||||
export PingMsg, PongMsg;
|
export PingMsg, PongMsg;
|
||||||
export create_content;
|
|
||||||
export Document;
|
export Document;
|
||||||
|
|
||||||
import std::arc::{arc, clone};
|
import std::arc::{arc, clone};
|
||||||
|
@ -51,6 +50,14 @@ enum PingMsg {
|
||||||
PongMsg
|
PongMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ContentTask = Chan<ControlMsg>;
|
||||||
|
|
||||||
|
fn ContentTask<S: Compositor send copy>(layout_task: LayoutTask, compositor: S, resource_task: ResourceTask) -> ContentTask {
|
||||||
|
do spawn_listener::<ControlMsg> |from_master| {
|
||||||
|
Content(layout_task, compositor, from_master, resource_task).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[doc="Sends a ping to layout and waits for the response."]
|
#[doc="Sends a ping to layout and waits for the response."]
|
||||||
#[allow(non_implicitly_copyable_typarams)]
|
#[allow(non_implicitly_copyable_typarams)]
|
||||||
fn join_layout(scope: NodeScope, layout_task: LayoutTask) {
|
fn join_layout(scope: NodeScope, layout_task: LayoutTask) {
|
||||||
|
@ -232,10 +239,3 @@ struct Content<C:Compositor send copy> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_content<S: Compositor send copy>(layout_task: LayoutTask, compositor: S, resource_task: ResourceTask) -> Chan<ControlMsg> {
|
|
||||||
do spawn_listener::<ControlMsg> |from_master| {
|
|
||||||
Content(layout_task, compositor, from_master, resource_task).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import js::crust::*;
|
||||||
import js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
|
import js::glue::bindgen::RUST_OBJECT_TO_JSVAL;
|
||||||
import dvec::{DVec, dvec};
|
import dvec::{DVec, dvec};
|
||||||
import ptr::null;
|
import ptr::null;
|
||||||
import content::Document;
|
import content::content_task::Document;
|
||||||
import bindings;
|
import bindings;
|
||||||
|
|
||||||
enum NodeData = {
|
enum NodeData = {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import ptr::null;
|
||||||
import libc::c_uint;
|
import libc::c_uint;
|
||||||
import utils::{DOMString, domstring_to_jsval, rust_box, squirrel_away, str};
|
import utils::{DOMString, domstring_to_jsval, rust_box, squirrel_away, str};
|
||||||
import bindings::node::create;
|
import bindings::node::create;
|
||||||
import content::Document;
|
import content::content_task::Document;
|
||||||
|
|
||||||
enum DOMException {
|
enum DOMException {
|
||||||
INVALID_CHARACTER_ERR
|
INVALID_CHARACTER_ERR
|
||||||
|
|
|
@ -4,7 +4,8 @@ import render_task::RenderTask;
|
||||||
import pipes::{spawn_service, select};
|
import pipes::{spawn_service, select};
|
||||||
import layout::layout_task;
|
import layout::layout_task;
|
||||||
import layout_task::LayoutTask;
|
import layout_task::LayoutTask;
|
||||||
import content::{Content, ExecuteMsg, ParseMsg, ExitMsg, create_content};
|
import content::content_task;
|
||||||
|
import content_task::{ContentTask};
|
||||||
import resource::resource_task;
|
import resource::resource_task;
|
||||||
import resource::resource_task::{ResourceTask};
|
import resource::resource_task::{ResourceTask};
|
||||||
import std::net::url::url;
|
import std::net::url::url;
|
||||||
|
@ -24,7 +25,7 @@ struct Engine<C:Compositor send copy> {
|
||||||
let resource_task: ResourceTask;
|
let resource_task: ResourceTask;
|
||||||
let image_cache_task: ImageCacheTask;
|
let image_cache_task: ImageCacheTask;
|
||||||
let layout_task: LayoutTask;
|
let layout_task: LayoutTask;
|
||||||
let content: comm::Chan<content::ControlMsg>;
|
let content_task: ContentTask;
|
||||||
|
|
||||||
new(+compositor: C) {
|
new(+compositor: C) {
|
||||||
self.compositor = compositor;
|
self.compositor = compositor;
|
||||||
|
@ -33,13 +34,13 @@ struct Engine<C:Compositor send copy> {
|
||||||
let resource_task = ResourceTask();
|
let resource_task = ResourceTask();
|
||||||
let image_cache_task = image_cache_task(resource_task);
|
let image_cache_task = image_cache_task(resource_task);
|
||||||
let layout_task = LayoutTask(render_task, image_cache_task);
|
let layout_task = LayoutTask(render_task, image_cache_task);
|
||||||
let content = create_content(layout_task, compositor, resource_task);
|
let content_task = ContentTask(layout_task, compositor, resource_task);
|
||||||
|
|
||||||
self.render_task = render_task;
|
self.render_task = render_task;
|
||||||
self.resource_task = resource_task;
|
self.resource_task = resource_task;
|
||||||
self.image_cache_task = image_cache_task;
|
self.image_cache_task = image_cache_task;
|
||||||
self.layout_task = layout_task;
|
self.layout_task = layout_task;
|
||||||
self.content = content;
|
self.content_task = content_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start() -> EngineProto::client::Running {
|
fn start() -> EngineProto::client::Running {
|
||||||
|
@ -54,15 +55,15 @@ struct Engine<C:Compositor send copy> {
|
||||||
// TODO: change copy to move once we have match move
|
// TODO: change copy to move once we have match move
|
||||||
let url = move_ref!(url);
|
let url = move_ref!(url);
|
||||||
if url.path.ends_with(".js") {
|
if url.path.ends_with(".js") {
|
||||||
self.content.send(ExecuteMsg(url))
|
self.content_task.send(content_task::ExecuteMsg(url))
|
||||||
} else {
|
} else {
|
||||||
self.content.send(ParseMsg(url))
|
self.content_task.send(content_task::ParseMsg(url))
|
||||||
}
|
}
|
||||||
request = next;
|
request = next;
|
||||||
},
|
},
|
||||||
|
|
||||||
Exit -> channel {
|
Exit -> channel {
|
||||||
self.content.send(content::ExitMsg);
|
self.content_task.send(content_task::ExitMsg);
|
||||||
self.layout_task.send(layout_task::ExitMsg);
|
self.layout_task.send(layout_task::ExitMsg);
|
||||||
|
|
||||||
let (response_chan, response_port) =
|
let (response_chan, response_port) =
|
||||||
|
|
|
@ -14,6 +14,7 @@ import resource::image_cache_task::ImageCacheTask;
|
||||||
import std::net::url::url;
|
import std::net::url::url;
|
||||||
import style::apply::apply_style;
|
import style::apply::apply_style;
|
||||||
import dom::event::{Event, ReflowEvent};
|
import dom::event::{Event, ReflowEvent};
|
||||||
|
import content::content_task;
|
||||||
|
|
||||||
import task::*;
|
import task::*;
|
||||||
import comm::*;
|
import comm::*;
|
||||||
|
@ -22,7 +23,7 @@ type LayoutTask = Chan<Msg>;
|
||||||
|
|
||||||
enum Msg {
|
enum Msg {
|
||||||
BuildMsg(Node, arc<Stylesheet>, url, Chan<Event>),
|
BuildMsg(Node, arc<Stylesheet>, url, Chan<Event>),
|
||||||
PingMsg(Chan<content::PingMsg>),
|
PingMsg(Chan<content_task::PingMsg>),
|
||||||
ExitMsg
|
ExitMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ fn LayoutTask(render_task: RenderTask, image_cache_task: ImageCacheTask) -> Layo
|
||||||
do spawn_listener::<Msg>|request| {
|
do spawn_listener::<Msg>|request| {
|
||||||
loop {
|
loop {
|
||||||
match request.recv() {
|
match request.recv() {
|
||||||
PingMsg(ping_channel) => ping_channel.send(content::PongMsg),
|
PingMsg(ping_channel) => ping_channel.send(content_task::PongMsg),
|
||||||
ExitMsg => {
|
ExitMsg => {
|
||||||
#debug("layout: ExitMsg received");
|
#debug("layout: ExitMsg received");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -106,6 +106,7 @@ mod util {
|
||||||
|
|
||||||
#[allow(non_implicitly_copyable_typarams)]
|
#[allow(non_implicitly_copyable_typarams)]
|
||||||
mod content {
|
mod content {
|
||||||
|
mod content_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod opts;
|
mod opts;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue