Skip to content

Commit

Permalink
Update for language changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Dec 23, 2012
1 parent 157227e commit be1935e
Show file tree
Hide file tree
Showing 36 changed files with 142 additions and 144 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/rust-azure
Submodule rust-azure updated from 37389b to cbe121
2 changes: 1 addition & 1 deletion src/rust-cairo
Submodule rust-cairo updated from 4fa661 to fda834
2 changes: 1 addition & 1 deletion src/rust-css
Submodule rust-css updated from 105bc0 to 7d37d8
2 changes: 1 addition & 1 deletion src/rust-geom
Submodule rust-geom updated from fda5dc to e0e4da
2 changes: 1 addition & 1 deletion src/rust-http-client
Submodule rust-http-client updated from b19573 to cbb848
2 changes: 1 addition & 1 deletion src/rust-mozjs
Submodule rust-mozjs updated from fb5f5a to 04e000
2 changes: 1 addition & 1 deletion src/rust-netsurfcss
Submodule rust-netsurfcss updated from 915654 to 261693
6 changes: 3 additions & 3 deletions src/servo-gfx/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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));
Expand Down
10 changes: 5 additions & 5 deletions src/servo-gfx/font_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern mod freetype;

use font_context::FreeTypeFontContextHandle;
use freetype_impl::font_context::FreeTypeFontContextHandle;
use gfx_font::{
CSSFontWeight,
FontHandle,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
};
Expand All @@ -14,7 +14,7 @@ use gfx_font::{
FontHandle,
UsedFontStyle,
};
use gfx_font_context::FontContextHandleMethods;
use font_context::FontContextHandleMethods;

pub struct FreeTypeFontContextHandle {
ctx: FT_Library,
Expand Down
6 changes: 3 additions & 3 deletions src/servo-gfx/geometry.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/servo-gfx/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};

Expand Down
9 changes: 5 additions & 4 deletions src/servo-gfx/render_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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();
Expand Down Expand Up @@ -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>,
Expand Down
2 changes: 1 addition & 1 deletion src/servo-gfx/resource/file_loader.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/servo-gfx/resource/http_loader.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
11 changes: 6 additions & 5 deletions src/servo-gfx/resource/image_cache_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = ~[];
Expand All @@ -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) => {
Expand Down Expand Up @@ -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| {
Expand Down
4 changes: 2 additions & 2 deletions src/servo-gfx/resource/resource_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
12 changes: 12 additions & 0 deletions src/servo-gfx/resource/util.rs
Original file line number Diff line number Diff line change
@@ -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)
}
22 changes: 2 additions & 20 deletions src/servo-gfx/servo_gfx.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
Loading

0 comments on commit be1935e

Please sign in to comment.