Update for language changes.

This commit is contained in:
Josh Matthews 2012-12-23 13:42:24 -05:00
parent 157227e8c2
commit be1935e9ad
36 changed files with 142 additions and 144 deletions

View file

@ -29,7 +29,7 @@ B := $(CFG_BUILD_DIR)
MKFILE_DEPS := config.stamp $(call rwildcard,$(S)mk/,*)
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
CFG_RUSTC_FLAGS := $(RUSTFLAGS) -A default_methods
ifdef CFG_DISABLE_OPTIMIZE
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))

View file

@ -8,7 +8,7 @@ against a released version of Rust will not work, nor will the Rust
'master' branch. The commit below will *probably* work. If it does not
then the topic in #servo might know better.
* Last known-good Rust commit: 54ae377ec26ed47bbb627bdcb58bb10658cf03c4
* Last known-good Rust commit: 3ee1d3ebb81de199fc630a86933ac18c0a869482
[rust]: http://www.rust-lang.org

@ -1 +1 @@
Subproject commit 37389b82bd5608b05b66edce7a4cce92c7edb3c6
Subproject commit cbe1210a6e62df8775f9b56a2ee589384600466a

@ -1 +1 @@
Subproject commit 4fa6613be800afb715b1be304274e074426475b4
Subproject commit fda83465dfb30e4724eac1f560e0e4b2d82a6783

@ -1 +1 @@
Subproject commit 105bc09e7d5988a5d8601d69efc5a22b73d634a4
Subproject commit 7d37d899a0fb038069a796ed4c866e6ec76cc268

@ -1 +1 @@
Subproject commit fda5dc9644e1eba2dbf4d1023ee3b6c6eda43b62
Subproject commit e0e4dab1caea0bbfa8a4e9b22b7ae04762d1d5f2

@ -1 +1 @@
Subproject commit b195738006d4b2c147ad10601cd2436f04888574
Subproject commit cbb84866b91aaff3fcd1dc774f61f76c4a7c3b0b

@ -1 +1 @@
Subproject commit fb5f5a5660f4b3af536b5dc314f7ebd059c0e291
Subproject commit 04e000311bf499dc12e71c686b7b3cd02fc84515

@ -1 +1 @@
Subproject commit 915654c60779a41ff7e419153a2f3d00a2d37416
Subproject commit 261693b63e8922a95204db3681209138627362c4

View file

@ -21,7 +21,7 @@ use geom::{Point2D, Rect, Size2D};
pub type FontHandle/& = quartz::font::QuartzFontHandle;
#[cfg(target_os = "linux")]
pub type FontHandle/& = freetype::font::FreeTypeFontHandle;
pub type FontHandle/& = freetype_impl::font::FreeTypeFontHandle;
pub trait FontHandleMethods {
// an identifier usable by FontContextHandle to recreate this FontHandle.
@ -51,7 +51,7 @@ pub impl FontHandle {
#[cfg(target_os = "linux")]
static pub fn new_from_buffer(fctx: &native::FontContextHandle, buf: ~[u8], style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
freetype::font::FreeTypeFontHandle::new_from_buffer(fctx, move buf, style)
freetype_impl::font::FreeTypeFontHandle::new_from_buffer(fctx, move buf, style)
}
}
@ -78,7 +78,7 @@ impl FontTableTag : FontTableTagConversions {
pub type FontTable/& = quartz::font::QuartzFontTable;
#[cfg(target_os = "linux")]
pub type FontTable/& = freetype::font::FreeTypeFontTable;
pub type FontTable/& = freetype_impl::font::FreeTypeFontTable;
pub trait FontTableMethods {
fn with_buffer(fn&(*u8, uint));

View file

@ -2,7 +2,7 @@ use font::{Font, FontDescriptor, FontGroup, FontStyle, SelectorPlatformIdentifie
use font::{SelectorStubDummy, SpecifiedFontStyle, UsedFontStyle};
use font_list::FontList;
use native::FontHandle;
use util::cache;
use util::cache::Cache;
use util::cache::MonoCache;
use azure::azure_hl::BackendType;
@ -34,7 +34,7 @@ pub fn dummy_style() -> FontStyle {
type FontContextHandle/& = quartz::font_context::QuartzFontContextHandle;
#[cfg(target_os = "linux")]
type FontContextHandle/& = freetype::font_context::FreeTypeFontContextHandle;
type FontContextHandle/& = freetype_impl::font_context::FreeTypeFontContextHandle;
pub trait FontContextHandleMethods {
pure fn clone(&const self) -> FontContextHandle;
@ -51,12 +51,12 @@ pub impl FontContextHandle {
#[cfg(target_os = "linux")]
static pub fn new() -> FontContextHandle {
freetype::font_context::FreeTypeFontContextHandle::new()
freetype_impl::font_context::FreeTypeFontContextHandle::new()
}
}
pub struct FontContext {
instance_cache: cache::MonoCache<FontDescriptor, @Font>,
instance_cache: MonoCache<FontDescriptor, @Font>,
font_list: Option<FontList>, // only needed by layout
handle: FontContextHandle,
backend: BackendType,
@ -78,7 +78,7 @@ pub impl FontContext {
FontContext {
// TODO(Rust #3902): remove extraneous type parameters once they are inferred correctly.
instance_cache: cache::new::<FontDescriptor,@Font,MonoCache<FontDescriptor,@Font>>(10),
instance_cache: Cache::new::<FontDescriptor,@Font,MonoCache<FontDescriptor,@Font>>(10),
font_list: move font_list,
handle: move handle,
backend: backend,

View file

@ -1,6 +1,6 @@
extern mod freetype;
use font_context::FreeTypeFontContextHandle;
use freetype_impl::font_context::FreeTypeFontContextHandle;
use gfx_font::{
CSSFontWeight,
FontHandle,
@ -17,7 +17,7 @@ use geometry::Au;
use text::glyph::GlyphIndex;
use text::util::{float_to_fixed, fixed_to_float};
use freetype::freetype::{
use self::freetype::freetype::{
FTErrorMethods,
FT_Error,
FT_F26Dot6,
@ -32,7 +32,7 @@ use freetype::freetype::{
FT_UInt,
FT_Size_Metrics,
};
use freetype::freetype::bindgen::{
use self::freetype::freetype::bindgen::{
FT_Init_FreeType,
FT_Done_FreeType,
FT_New_Memory_Face,

View file

@ -1,11 +1,11 @@
extern mod freetype;
use freetype::freetype::{
use self::freetype::freetype::{
FTErrorMethods,
FT_Error,
FT_Library,
};
use freetype::freetype::bindgen::{
use self::freetype::freetype::bindgen::{
FT_Init_FreeType,
FT_Done_FreeType
};
@ -14,7 +14,7 @@ use gfx_font::{
FontHandle,
UsedFontStyle,
};
use gfx_font_context::FontContextHandleMethods;
use font_context::FontContextHandleMethods;
pub struct FreeTypeFontContextHandle {
ctx: FT_Library,

View file

@ -1,7 +1,7 @@
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
use num::{Num, from_int};
use num::Num;
pub enum Au = i32;
@ -45,7 +45,7 @@ impl Au {
}
static pub pure fn from_px(i: int) -> Au {
from_int(i * 60)
Num::from_int(i * 60)
}
pub pure fn to_px(&const self) -> int {
@ -98,7 +98,7 @@ pub pure fn from_frac_px(f: float) -> Au {
}
pub pure fn from_px(i: int) -> Au {
from_int(i * 60)
Num::from_int(i * 60)
}
pub pure fn to_px(au: Au) -> int {

View file

@ -66,12 +66,12 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts {
};
let tile_size: uint = match getopts::opt_maybe_str(&opt_match, ~"s") {
Some(move tile_size_str) => from_str::from_str(tile_size_str).get(),
Some(move tile_size_str) => uint::from_str(tile_size_str).get(),
None => 512,
};
let n_render_threads: uint = match getopts::opt_maybe_str(&opt_match, ~"t") {
Some(move n_render_threads_str) => from_str::from_str(n_render_threads_str).get(),
Some(move n_render_threads_str) => uint::from_str(n_render_threads_str).get(),
None => 1, // FIXME: Number of cores.
};

View file

@ -3,9 +3,10 @@ use font_context::FontContext;
use opts::Opts;
use render_context::RenderContext;
use render_layers::{RenderLayer, render_layers};
use resource::util::spawn_listener;
use azure::AzFloat;
use core::comm::*;
use core::oldcomm::*;
use core::libc::size_t;
use core::libc::types::common::c99::uint16_t;
use core::pipes::{Port, Chan};
@ -21,12 +22,12 @@ pub enum Msg {
ExitMsg(pipes::Chan<()>)
}
pub type RenderTask = comm::Chan<Msg>;
pub type RenderTask = oldcomm::Chan<Msg>;
pub fn RenderTask<C: Compositor Owned>(compositor: C, opts: Opts) -> RenderTask {
let compositor_cell = Cell(move compositor);
let opts_cell = Cell(move opts);
do task::spawn_listener |po: comm::Port<Msg>, move compositor_cell, move opts_cell| {
do spawn_listener |po: oldcomm::Port<Msg>, move compositor_cell, move opts_cell| {
let (layer_buffer_set_port, layer_buffer_channel) = pipes::stream();
let compositor = compositor_cell.take();
@ -68,7 +69,7 @@ priv struct ThreadRenderContext {
}
priv struct Renderer<C: Compositor Owned> {
port: comm::Port<Msg>,
port: oldcomm::Port<Msg>,
compositor: C,
layer_buffer_set_port: Cell<pipes::Port<LayerBufferSet>>,
thread_pool: TaskPool<ThreadRenderContext>,

View file

@ -1,6 +1,6 @@
export factory;
use comm::Chan;
use oldcomm::Chan;
use task::spawn;
use resource::resource_task::{ProgressMsg, Payload, Done};
use std::net::url::Url;

View file

@ -1,6 +1,6 @@
export factory;
use comm::Chan;
use oldcomm::Chan;
use task::spawn;
use resource::resource_task::{ProgressMsg, Payload, Done};
use std::net::url::Url;

View file

@ -5,7 +5,8 @@ use util::url::{make_url, UrlMap, url_map};
use clone_arc = std::arc::clone;
use core::pipes::{Chan, Port, SharedChan, stream};
use core::task::{spawn, spawn_listener};
use core::task::spawn;
use resource::util::spawn_listener;
use core::to_str::ToStr;
use core::util::replace;
use std::arc::ARC;
@ -464,7 +465,7 @@ impl ImageCacheTask: ImageCacheTaskClient {
}
fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<~[u8], ()> {
let response_port = comm::Port();
let response_port = oldcomm::Port();
resource_task.send(resource_task::Load(move url, response_port.chan()));
let mut image_data = ~[];
@ -489,8 +490,8 @@ fn default_decoder_factory() -> ~fn(&[u8]) -> Option<Image> {
}
#[cfg(test)]
fn mock_resource_task(on_load: ~fn(resource: comm::Chan<resource_task::ProgressMsg>)) -> ResourceTask {
do spawn_listener |port: comm::Port<resource_task::ControlMsg>, move on_load| {
fn mock_resource_task(on_load: ~fn(resource: oldcomm::Chan<resource_task::ProgressMsg>)) -> ResourceTask {
do spawn_listener |port: oldcomm::Port<resource_task::ControlMsg>, move on_load| {
loop {
match port.recv() {
resource_task::Load(_, response) => {
@ -530,7 +531,7 @@ fn should_fail_if_unprefetched_image_is_requested() {
#[test]
fn should_request_url_from_resource_task_on_prefetch() {
let url_requested = comm::Port();
let url_requested = oldcomm::Port();
let url_requested_chan = url_requested.chan();
let mock_resource_task = do mock_resource_task |response| {

View file

@ -4,8 +4,8 @@ A task that takes a URL and streams back the binary data
*/
use comm::{Chan, Port};
use task::{spawn, spawn_listener};
use oldcomm::{Chan, Port};
use resource::util::spawn_listener;
use std::net::url;
use std::net::url::{Url, to_str};

View file

@ -0,0 +1,12 @@
pub fn spawn_listener<A: Owned>(
+f: fn~(oldcomm::Port<A>)) -> oldcomm::Chan<A> {
let setup_po = oldcomm::Port();
let setup_ch = oldcomm::Chan(&setup_po);
do task::spawn |move f| {
let po = oldcomm::Port();
let ch = oldcomm::Chan(&po);
oldcomm::send(setup_ch, ch);
f(move po);
}
oldcomm::recv(setup_po)
}

View file

@ -36,37 +36,28 @@ pub mod native;
#[cfg(target_os = "macos")]
pub mod quartz {
#[path = "quartz/font.rs"]
pub mod font;
#[path = "quartz/font_context.rs"]
pub mod font_context;
#[path = "quartz/font_list.rs"]
pub mod font_list;
}
#[cfg(target_os = "linux")]
pub mod freetype {
#[path = "freetype/font.rs"]
pub mod freetype_impl {
pub mod font;
#[path = "freetype/font_context.rs"]
pub mod font_context;
}
#[cfg(target_os = "linux")]
pub mod fontconfig {
#[path = "fontconfig/font_list.rs"]
pub mod font_list;
}
// Images
pub mod image {
#[path = "image/base.rs"]
pub mod base;
pub mod encode {
#[path = "image/encode/tga.rs"]
pub mod tga;
}
#[path = "image/holder.rs"]
pub mod holder;
}
@ -76,28 +67,19 @@ pub mod text;
// FIXME: Blech. This does not belong in the GFX module.
pub mod resource {
#[path = "resource/file_loader.rs"]
pub mod file_loader;
#[path = "resource/http_loader.rs"]
pub mod http_loader;
#[path = "resource/image_cache_task.rs"]
pub mod image_cache_task;
#[path = "resource/local_image_cache.rs"]
pub mod local_image_cache;
#[path = "resource/resource_task.rs"]
pub mod resource_task;
pub mod util;
}
pub mod util {
#[path = "util/cache.rs"]
pub mod cache;
#[path = "util/range.rs"]
pub mod range;
#[path = "util/time.rs"]
pub mod time;
#[path = "util/url.rs"]
pub mod url;
#[path = "util/vec.rs"]
pub mod vec;
}

View file

@ -4,10 +4,10 @@ use servo_gfx_util::vec::*;
use core::cmp::{Ord, Eq};
use core::dvec::DVec;
use core::num::from_int;
use core::u16;
use geom::point::Point2D;
use std::sort;
use num::Num;
// GlyphEntry is a port of Gecko's CompressedGlyph scheme for storing
@ -172,7 +172,7 @@ impl GlyphEntry {
#[inline(always)]
pure fn advance() -> Au {
//assert self.is_simple();
from_int(((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) as int)
Num::from_int(((self.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) as int)
}
pure fn index() -> GlyphIndex {

View file

@ -15,6 +15,5 @@ pub mod shaper;
// Below are the actual platform-specific parts.
pub mod harfbuzz {
#[path = "harfbuzz/shaper.rs"]
pub mod shaper;
}

View file

@ -1,6 +1,6 @@
use core::cmp::*;
trait Cache<K: Copy Eq, V: Copy> {
pub trait Cache<K: Copy Eq, V: Copy> {
static fn new(size: uint) -> self;
fn insert(key: &K, value: V);
fn find(key: &K) -> Option<V>;

View file

@ -11,10 +11,11 @@ use dom::window::Window;
use layout::layout_task;
use layout::layout_task::{AddStylesheet, BuildData, BuildMsg, Damage, LayoutTask};
use layout::layout_task::{MatchSelectorsDamage, NoDamage, ReflowDamage};
use util::task::spawn_listener;
use core::comm::{Port, Chan, listen, select2};
use core::oldcomm::{Port, Chan, listen, select2};
use core::either;
use core::task::{SingleThreaded, spawn, spawn_listener, task};
use core::task::{SingleThreaded, spawn, task};
use core::io::{println, read_whole_file};
use core::ptr::null;
use core::util::replace;
@ -234,7 +235,7 @@ impl Content {
//TODO: support extra args. requires passing a *JSVal argv
JS_CallFunctionValue(self.cx.ptr, thisValue, timerData.funval,
0, null(), ptr::to_unsafe_ptr(&rval));
self.relayout(self.document.get(), &self.doc_url.get());
self.relayout(self.document.get(), &(copy self.doc_url).get());
return true;
}
@ -325,7 +326,7 @@ impl Content {
}
fn query_layout(query: layout_task::LayoutQuery) -> layout_task::LayoutQueryResponse {
self.relayout(self.document.get(), &self.doc_url.get());
self.relayout(self.document.get(), &(copy self.doc_url).get());
self.join_layout();
let response_port = Port();
@ -349,7 +350,7 @@ impl Content {
}
Some(document) => {
assert self.doc_url.is_some();
self.relayout(document, &self.doc_url.get());
self.relayout(document, &(copy self.doc_url).get());
}
}
response_chan.send(());
@ -364,7 +365,7 @@ impl Content {
}
Some(document) => {
assert self.doc_url.is_some();
self.relayout(document, &self.doc_url.get());
self.relayout(document, &(copy self.doc_url).get());
}
}
return true;

View file

@ -1,7 +1,8 @@
use comm::{Port, Chan};
use oldcomm::{Port, Chan};
use content::content_task::{ControlMsg, Timer, ExitMsg};
use js::jsapi::JSVal;
use dvec::DVec;
use util::task::spawn_listener;
pub enum TimerControlMsg {
TimerMessage_Fire(~TimerData),
@ -66,8 +67,8 @@ impl Window {
pub fn Window(content_chan: pipes::SharedChan<ControlMsg>) -> Window {
Window {
timer_chan: do task::spawn_listener |timer_port: Port<TimerControlMsg>,
move content_chan| {
timer_chan: do spawn_listener |timer_port: Port<TimerControlMsg>,
move content_chan| {
loop {
match move timer_port.recv() {
TimerMessage_Close => break,

View file

@ -6,9 +6,9 @@ use layout::layout_task::LayoutTask;
use resource::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use resource::resource_task::ResourceTask;
use resource::resource_task;
use util::task::spawn_listener;
use core::pipes::{Port, Chan};
use core::task::spawn_listener;
use gfx::compositor::Compositor;
use gfx::opts::Opts;
use gfx::render_task::RenderTask;
@ -16,7 +16,7 @@ use gfx::render_task;
use std::cell::Cell;
use std::net::url::Url;
pub type EngineTask = comm::Chan<Msg>;
pub type EngineTask = oldcomm::Chan<Msg>;
pub enum Msg {
LoadURLMsg(Url),
@ -24,7 +24,7 @@ pub enum Msg {
}
pub struct Engine<C:Compositor Owned Copy> {
request_port: comm::Port<Msg>,
request_port: oldcomm::Port<Msg>,
compositor: C,
render_task: RenderTask,
resource_task: ResourceTask,

View file

@ -18,9 +18,9 @@ pub enum StylesheetProvenance {
}
pub fn spawn_css_parser(provenance: StylesheetProvenance,
resource_task: ResourceTask) -> comm::Port<Stylesheet> {
let result_port = comm::Port();
let result_chan = comm::Chan(&result_port);
resource_task: ResourceTask) -> oldcomm::Port<Stylesheet> {
let result_port = oldcomm::Port();
let result_chan = oldcomm::Chan(&result_port);
let provenance_cell = Cell(move provenance);
do task::spawn |move provenance_cell, copy resource_task| {
@ -51,7 +51,7 @@ fn data_stream(provenance: StylesheetProvenance, resource_task: ResourceTask) ->
}
}
fn resource_port_to_data_stream(input_port: comm::Port<ProgressMsg>) -> DataStream {
fn resource_port_to_data_stream(input_port: oldcomm::Port<ProgressMsg>) -> DataStream {
return || {
match input_port.recv() {
Payload(move data) => Some(move data),

View file

@ -7,8 +7,9 @@ use dom::node::{Comment, Doctype, DoctypeData, Element, Node, NodeScope, Text};
use resource::image_cache_task::ImageCacheTask;
use resource::image_cache_task;
use resource::resource_task::{Done, Load, Payload, ResourceTask};
use util::task::{spawn_listener, spawn_conversation};
use core::comm::{Chan, Port};
use core::oldcomm::{Chan, Port};
use html::cssparse::{InlineProvenance, StylesheetProvenance, UrlProvenance, spawn_css_parser};
use hubbub::hubbub::Attribute;
use hubbub::hubbub;
@ -30,8 +31,8 @@ enum JSMessage {
struct HtmlParserResult {
root: Node,
style_port: comm::Port<Option<Stylesheet>>,
js_port: comm::Port<JSResult>,
style_port: oldcomm::Port<Option<Stylesheet>>,
js_port: oldcomm::Port<JSResult>,
}
/**
@ -49,8 +50,8 @@ spawned, collates them, and sends them to the given result channel.
* `from_parent` - A port on which to receive new links.
*/
fn css_link_listener(to_parent : comm::Chan<Option<Stylesheet>>,
from_parent : comm::Port<CSSMessage>,
fn css_link_listener(to_parent : oldcomm::Chan<Option<Stylesheet>>,
from_parent : oldcomm::Port<CSSMessage>,
resource_task: ResourceTask) {
let mut result_vec = ~[];
@ -73,15 +74,15 @@ fn css_link_listener(to_parent : comm::Chan<Option<Stylesheet>>,
to_parent.send(None);
}
fn js_script_listener(to_parent : comm::Chan<~[~[u8]]>, from_parent : comm::Port<JSMessage>,
fn js_script_listener(to_parent : oldcomm::Chan<~[~[u8]]>, from_parent : oldcomm::Port<JSMessage>,
resource_task: ResourceTask) {
let mut result_vec = ~[];
loop {
match from_parent.recv() {
JSTaskNewFile(move url) => {
let result_port = comm::Port();
let result_chan = comm::Chan(&result_port);
let result_port = oldcomm::Port();
let result_chan = oldcomm::Chan(&result_port);
do task::spawn |move url| {
let input_port = Port();
// TODO: change copy to move once we can move into closures
@ -163,16 +164,16 @@ pub fn parse_html(scope: NodeScope,
resource_task: ResourceTask,
image_cache_task: ImageCacheTask) -> HtmlParserResult unsafe {
// Spawn a CSS parser to receive links to CSS style sheets.
let (css_port, css_chan): (comm::Port<Option<Stylesheet>>, comm::Chan<CSSMessage>) =
do task::spawn_conversation |css_port: comm::Port<CSSMessage>,
css_chan: comm::Chan<Option<Stylesheet>>| {
let (css_port, css_chan): (oldcomm::Port<Option<Stylesheet>>, oldcomm::Chan<CSSMessage>) =
do spawn_conversation |css_port: oldcomm::Port<CSSMessage>,
css_chan: oldcomm::Chan<Option<Stylesheet>>| {
css_link_listener(css_chan, css_port, resource_task);
};
// Spawn a JS parser to receive JavaScript.
let (js_port, js_chan): (comm::Port<JSResult>, comm::Chan<JSMessage>) =
do task::spawn_conversation |js_port: comm::Port<JSMessage>,
js_chan: comm::Chan<JSResult>| {
let (js_port, js_chan): (oldcomm::Port<JSResult>, oldcomm::Chan<JSMessage>) =
do spawn_conversation |js_port: oldcomm::Port<JSMessage>,
js_chan: oldcomm::Chan<JSResult>| {
js_script_listener(js_chan, js_port, resource_task);
};
@ -337,7 +338,7 @@ pub fn parse_html(scope: NodeScope,
complete_script: |script| {
// A little function for holding this lint attr
#[allow(non_implicitly_copyable_typarams)]
fn complete_script(scope: &NodeScope, script: hubbub::NodeDataPtr, url: &Url, js_chan: &comm::Chan<JSMessage>) unsafe {
fn complete_script(scope: &NodeScope, script: hubbub::NodeDataPtr, url: &Url, js_chan: &oldcomm::Chan<JSMessage>) unsafe {
do scope.read(&cow::wrap(cast::transmute(script))) |node_contents| {
match *node_contents.kind {
Element(ref element) if element.tag_name == ~"script" => {

View file

@ -15,8 +15,9 @@ use layout::traverse::*;
use resource::image_cache_task::{ImageCacheTask, ImageResponseMsg};
use resource::local_image_cache::LocalImageCache;
use util::time::time;
use util::task::spawn_listener;
use core::comm::*; // FIXME: Bad! Pipe-ify me.
use core::oldcomm::*; // FIXME: Bad! Pipe-ify me.
use core::dvec::DVec;
use core::mutable::Mut;
use core::task::*;
@ -38,7 +39,7 @@ use std::arc::ARC;
use std::cell::Cell;
use std::net::url::Url;
pub type LayoutTask = comm::Chan<Msg>;
pub type LayoutTask = oldcomm::Chan<Msg>;
pub enum LayoutQuery {
ContentBox(Node)
@ -53,7 +54,7 @@ enum LayoutQueryResponse_ {
pub enum Msg {
AddStylesheet(Stylesheet),
BuildMsg(BuildData),
QueryMsg(LayoutQuery, comm::Chan<LayoutQueryResponse>),
QueryMsg(LayoutQuery, oldcomm::Chan<LayoutQueryResponse>),
ExitMsg
}
@ -96,7 +97,7 @@ struct Layout {
render_task: RenderTask,
image_cache_task: ImageCacheTask,
local_image_cache: @LocalImageCache,
from_content: comm::Port<Msg>,
from_content: oldcomm::Port<Msg>,
font_ctx: @FontContext,
// This is used to root auxilliary RCU reader data
@ -106,7 +107,7 @@ struct Layout {
fn Layout(render_task: RenderTask,
image_cache_task: ImageCacheTask,
from_content: comm::Port<Msg>,
from_content: oldcomm::Port<Msg>,
opts: &Opts) -> Layout {
let fctx = @FontContext::new(opts.render_backend, true);
@ -251,7 +252,7 @@ impl Layout {
fn handle_query(query: LayoutQuery,
reply_chan: comm::Chan<LayoutQueryResponse>) {
reply_chan: oldcomm::Chan<LayoutQueryResponse>) {
match query {
ContentBox(node) => {
let response = do node.aux |a| {

View file

@ -20,7 +20,7 @@ use std::cmp::FuzzyEq;
use glut::glut;
pub struct OSMain {
chan: comm::Chan<Msg>
chan: oldcomm::Chan<Msg>
}
// FIXME: Move me over to opts.rs.
@ -83,7 +83,7 @@ impl AzureDrawTargetImageData : layers::layers::ImageData {
}
fn mainloop(mode: Mode,
po: comm::Port<Msg>,
po: oldcomm::Port<Msg>,
dom_event_chan: pipes::SharedChan<Event>,
opts: &Opts) {
let key_handlers: @DVec<pipes::Chan<()>> = @DVec();
@ -98,7 +98,7 @@ fn mainloop(mode: Mode,
window = GlutWindow(move glut_window);
}
ShareMode => {
let share_context: ShareGlContext = sharegl::base::new(Size2D(800, 600));
let share_context: ShareGlContext = sharegl::base::ShareContext::new(Size2D(800, 600));
io::println(fmt!("Sharing ID is %d", share_context.id()));
window = ShareWindow(move share_context);
}
@ -334,8 +334,16 @@ fn Surface(backend: BackendType) -> Surface {
}
/// A function for spawning into the platform's main thread
fn on_osmain<T: Owned>(f: fn~(po: comm::Port<T>)) -> comm::Chan<T> {
task::task().sched_mode(task::PlatformThread).spawn_listener(move f)
fn on_osmain<T: Owned>(f: fn~(po: oldcomm::Port<T>)) -> oldcomm::Chan<T> {
let setup_po = oldcomm::Port();
let setup_ch = oldcomm::Chan(&setup_po);
do task::task().sched_mode(task::PlatformThread).spawn |move f| {
let po = oldcomm::Port();
let ch = oldcomm::Chan(&po);
oldcomm::send(setup_ch, ch);
f(move po);
}
oldcomm::recv(setup_po)
}
// #[cfg(target_os = "linux")]

View file

@ -23,97 +23,61 @@ extern mod stb_image;
extern mod std;
pub mod content {
#[path = "content/content_task.rs"]
pub mod content_task;
}
pub mod css {
#[path = "css/select_handler.rs"]
priv mod select_handler;
#[path = "css/node_util.rs"]
priv mod node_util;
#[path = "css/node_void_ptr.rs"]
priv mod node_void_ptr;
#[path = "css/select.rs"]
pub mod select;
#[path = "css/matching.rs"]
pub mod matching;
#[path = "css/node_style.rs"]
pub mod node_style;
}
pub mod dom {
pub mod bindings {
#[path = "dom/bindings/document.rs"]
pub mod document;
#[path = "dom/bindings/element.rs"]
pub mod element;
#[path = "dom/bindings/node.rs"]
pub mod node;
#[path = "dom/bindings/utils.rs"]
pub mod utils;
#[path = "dom/bindings/window.rs"]
pub mod window;
}
#[path = "dom/cow.rs"]
pub mod cow;
#[path = "dom/document.rs"]
pub mod document;
#[path = "dom/element.rs"]
pub mod element;
#[path = "dom/event.rs"]
pub mod event;
#[path = "dom/node.rs"]
pub mod node;
#[path = "dom/window.rs"]
pub mod window;
}
pub mod engine;
pub mod layout {
#[path = "layout/block.rs"]
pub mod block;
#[path = "layout/box.rs"]
pub mod box;
#[path = "layout/box_builder.rs"]
pub mod box_builder;
#[path = "layout/context.rs"]
pub mod context;
#[path = "layout/debug.rs"]
pub mod debug;
#[path = "layout/display_list_builder.rs"]
pub mod display_list_builder;
#[path = "layout/flow.rs"]
pub mod flow;
#[path = "layout/layout_task.rs"]
pub mod layout_task;
#[path = "layout/inline.rs"]
pub mod inline;
#[path = "layout/root.rs"]
pub mod root;
#[path = "layout/text.rs"]
pub mod text;
#[path = "layout/traverse.rs"]
pub mod traverse;
#[path = "layout/aux.rs"]
mod aux;
}
pub mod html {
#[path = "html/cssparse.rs"]
pub mod cssparse;
#[path = "html/hubbub_html_parser.rs"]
pub mod hubbub_html_parser;
}
pub mod platform {
#[path = "platform/base.rs"]
pub mod base;
#[path = "platform/osmain.rs"]
pub mod osmain;
#[path = "platform/resize_rate_limiter.rs"]
priv mod resize_rate_limiter;
}
@ -130,7 +94,7 @@ extern mod core_text;
use engine::{Engine, ExitMsg, LoadURLMsg}; // FIXME: "ExitMsg" is pollution.
use platform::osmain::{AddKeyHandler, OSMain};
use core::comm::*; // FIXME: Bad!
use core::oldcomm::*; // FIXME: Bad!
use core::option::swap_unwrap;
use core::pipes::{Port, Chan};

View file

@ -3,6 +3,7 @@ An actor type
*/
use pipes::{Port, Chan, SharedChan, stream};
use core::task;
/**
The client reference to an actor

View file

@ -3,3 +3,4 @@ pub use gfx::util::time;
pub mod actor;
pub mod tree;
pub mod task;

25
src/servo/util/task.rs Normal file
View file

@ -0,0 +1,25 @@
use core::task;
pub fn spawn_listener<A: Owned>(
+f: fn~(oldcomm::Port<A>)) -> oldcomm::Chan<A> {
let setup_po = oldcomm::Port();
let setup_ch = oldcomm::Chan(&setup_po);
do task::spawn |move f| {
let po = oldcomm::Port();
let ch = oldcomm::Chan(&po);
oldcomm::send(setup_ch, ch);
f(move po);
}
oldcomm::recv(setup_po)
}
pub fn spawn_conversation<A: Owned, B: Owned>
(+f: fn~(oldcomm::Port<A>, oldcomm::Chan<B>))
-> (oldcomm::Port<B>, oldcomm::Chan<A>) {
let from_child = oldcomm::Port();
let to_parent = oldcomm::Chan(&from_child);
let to_child = do spawn_listener |move f, from_parent| {
f(from_parent, to_parent)
};
(from_child, to_child)
}