Skip to content

Commit

Permalink
Update for language changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
luqmana committed Apr 20, 2013
1 parent 76f541f commit 21e8ba6
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/rust
Submodule rust updated from 783392 to 2b0926
2 changes: 1 addition & 1 deletion src/rust-core-foundation
2 changes: 1 addition & 1 deletion src/rust-css
2 changes: 1 addition & 1 deletion src/rust-netsurfcss
2 changes: 1 addition & 1 deletion src/rust-wapcaplet
4 changes: 2 additions & 2 deletions src/servo-gfx/display_list.rs
Expand Up @@ -34,8 +34,8 @@ pub enum DisplayItem {
Border(DisplayItemData, Au, Color)
}

pub impl DisplayItem {
fn d(&self) -> &'self DisplayItemData {
pub impl<'self> DisplayItem {
fn d(&'self self) -> &'self DisplayItemData {
match *self {
SolidColor(ref d, _) => d,
Text(ref d, _, _, _) => d,
Expand Down
2 changes: 1 addition & 1 deletion src/servo-gfx/font_context.rs
Expand Up @@ -73,7 +73,7 @@ pub impl<'self> FontContext {
}
}

priv fn get_font_list(&self) -> &'self FontList {
priv fn get_font_list(&'self self) -> &'self FontList {
self.font_list.get_ref()
}

Expand Down
14 changes: 8 additions & 6 deletions src/servo-gfx/render_task.rs
Expand Up @@ -52,15 +52,17 @@ pub fn RenderTask<C:Compositor + Owned>(compositor: C, opts: Opts) -> RenderTask
f
};

Renderer {
// FIXME: rust/#5967
let mut r = Renderer {
port: po,
compositor: compositor,
mut layer_buffer_set_port: Cell(layer_buffer_set_port),
layer_buffer_set_port: Cell(layer_buffer_set_port),
thread_pool: thread_pool,
opts: opts_cell.take()
}.start();
};
r.start();
};
SharedChan(render_task)
SharedChan::new(render_task)
}

/// Data that needs to be kept around for each render thread.
Expand All @@ -79,7 +81,7 @@ priv struct Renderer<C> {
}

impl<C: Compositor + Owned> Renderer<C> {
fn start(&self) {
fn start(&mut self) {
debug!("renderer: beginning rendering loop");

loop {
Expand All @@ -93,7 +95,7 @@ impl<C: Compositor + Owned> Renderer<C> {
}
}

fn render(&self, render_layer: RenderLayer) {
fn render(&mut self, render_layer: RenderLayer) {
debug!("renderer: got render request");

let layer_buffer_set_port = self.layer_buffer_set_port.take();
Expand Down
2 changes: 1 addition & 1 deletion src/servo-gfx/resource/http_loader.rs
Expand Up @@ -12,7 +12,7 @@ pub fn factory() -> LoaderTask {
let f: LoaderTask = |url, progress_chan| {
assert!(url.scheme == ~"http");

let progress_chan = SharedChan(progress_chan);
let progress_chan = SharedChan::new(progress_chan);
do spawn {
debug!("http_loader: requesting via http: %?", url.clone());
let mut request = uv_http_request(url.clone());
Expand Down
4 changes: 2 additions & 2 deletions src/servo-gfx/resource/image_cache_task.rs
Expand Up @@ -96,7 +96,7 @@ pub fn ImageCacheTask_(resource_task: ResourceTask,
let decoder_factory_cell = Cell(decoder_factory);

let (port, chan) = stream();
let chan = SharedChan(chan);
let chan = SharedChan::new(chan);
let port_cell = Cell(port);
let chan_cell = Cell(chan.clone());

Expand Down Expand Up @@ -140,7 +140,7 @@ fn SyncImageCacheTask(resource_task: ResourceTask) -> ImageCacheTask {
}
}

return SharedChan(chan);
return SharedChan::new(chan);
}

struct ImageCache {
Expand Down
2 changes: 1 addition & 1 deletion src/servo-gfx/resource/resource_task.rs
Expand Up @@ -59,7 +59,7 @@ fn create_resource_task_with_loaders(loaders: ~[(~str, LoaderTaskFactory)]) -> R
// TODO: change copy to move once we can move out of closures
ResourceManager(from_client, loaders_cell.take()).start()
};
SharedChan(chan)
SharedChan::new(chan)
}

pub struct ResourceManager {
Expand Down
15 changes: 8 additions & 7 deletions src/servo-gfx/text/glyph.rs
Expand Up @@ -306,7 +306,7 @@ struct DetailedGlyphStore {
lookup_is_sorted: bool,
}

impl DetailedGlyphStore {
impl<'self> DetailedGlyphStore {
fn new() -> DetailedGlyphStore {
DetailedGlyphStore {
detail_buffer: ~[], // TODO: default size?
Expand Down Expand Up @@ -339,7 +339,7 @@ impl DetailedGlyphStore {
self.lookup_is_sorted = false;
}

fn get_detailed_glyphs_for_entry(&self, entry_offset: uint, count: u16)
fn get_detailed_glyphs_for_entry(&'self self, entry_offset: uint, count: u16)
-> &'self [DetailedGlyph] {
debug!("Requesting detailed glyphs[n=%u] for entry[off=%u]", count as uint, entry_offset);

Expand Down Expand Up @@ -369,7 +369,7 @@ impl DetailedGlyphStore {
}
}

fn get_detailed_glyph_with_index(&self,
fn get_detailed_glyph_with_index(&'self self,
entry_offset: uint,
detail_offset: u16)
-> &'self DetailedGlyph {
Expand Down Expand Up @@ -507,7 +507,7 @@ pub struct GlyphStore {
detail_store: DetailedGlyphStore,
}

pub impl GlyphStore {
pub impl<'self> GlyphStore {
// Initializes the glyph store, but doesn't actually shape anything.
// Use the set_glyph, set_glyphs() methods to store glyph data.
fn new(length: uint) -> GlyphStore {
Expand Down Expand Up @@ -585,7 +585,7 @@ pub impl GlyphStore {
self.entry_buffer[i] = entry;
}

fn iter_glyphs_for_char_index(&self,
fn iter_glyphs_for_char_index(&'self self,
i: uint,
cb: &fn(uint, &GlyphInfo<'self>) -> bool)
-> bool {
Expand All @@ -609,7 +609,8 @@ pub impl GlyphStore {
true
}

fn iter_glyphs_for_char_range(&self, range: &Range, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
fn iter_glyphs_for_char_range(&'self self, range: &Range,
cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
if range.begin() >= self.entry_buffer.len() {
error!("iter_glyphs_for_range: range.begin beyond length!");
return;
Expand All @@ -626,7 +627,7 @@ pub impl GlyphStore {
}
}

fn iter_all_glyphs(&self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
fn iter_all_glyphs(&'self self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) {
for uint::range(0, self.entry_buffer.len()) |i| {
if !self.iter_glyphs_for_char_index(i, cb) {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/servo-gfx/text/text_run.rs
Expand Up @@ -37,7 +37,7 @@ impl SendableTextRun {
}
}

pub impl TextRun {
pub impl<'self> TextRun {
fn new(font: @mut Font, text: ~str) -> TextRun {
let mut glyph_store = GlyphStore::new(str::char_len(text));
TextRun::compute_potential_breaks(text, &mut glyph_store);
Expand Down Expand Up @@ -102,7 +102,7 @@ pub impl TextRun {
}

fn char_len(&self) -> uint { self.glyphs.entry_buffer.len() }
fn glyphs(&self) -> &'self GlyphStore { &self.glyphs }
fn glyphs(&'self self) -> &'self GlyphStore { &self.glyphs }

fn range_is_trimmable_whitespace(&self, range: &Range) -> bool {
for range.eachi |i| {
Expand Down
4 changes: 2 additions & 2 deletions src/servo-util/vec.rs
Expand Up @@ -4,12 +4,12 @@

use core::cmp::{Ord, Eq};

pub trait BinarySearchMethods<T: Ord + Eq> {
pub trait BinarySearchMethods<'self, T: Ord + Eq> {
fn binary_search(&self, key: &T) -> Option<&'self T>;
fn binary_search_index(&self, key: &T) -> Option<uint>;
}

impl<'self, T: Ord + Eq> BinarySearchMethods<T> for &'self [T] {
impl<'self, T: Ord + Eq> BinarySearchMethods<'self, T> for &'self [T] {
fn binary_search(&self, key: &T) -> Option<&'self T> {
match self.binary_search_index(key) {
None => None,
Expand Down
2 changes: 1 addition & 1 deletion src/servo/content/content_task.rs
Expand Up @@ -60,7 +60,7 @@ pub fn ContentTask(layout_task: LayoutTask,
-> ContentTask {
let (control_port, control_chan) = comm::stream();

let control_chan = SharedChan(control_chan);
let control_chan = SharedChan::new(control_chan);
let control_chan_copy = control_chan.clone();
let control_port = Cell(control_port);
let dom_event_port = Cell(dom_event_port);
Expand Down
4 changes: 2 additions & 2 deletions src/servo/css/node_style.rs
Expand Up @@ -10,11 +10,11 @@ use newcss::complete::CompleteStyle;

/// Node mixin providing `style` method that returns a `NodeStyle`
pub trait StyledNode {
fn style(&self) -> CompleteStyle<'self>;
fn style<'a>(&'a self) -> CompleteStyle<'a>;
}

impl StyledNode for AbstractNode {
fn style(&self) -> CompleteStyle<'self> {
fn style<'a>(&'a self) -> CompleteStyle<'a> {
assert!(self.is_element()); // Only elements can have styles
let results = self.get_css_select_results();
results.computed_style()
Expand Down
4 changes: 2 additions & 2 deletions src/servo/dom/element.rs
Expand Up @@ -112,7 +112,7 @@ pub struct HTMLImageElement {
// Element methods
//

pub impl Element {
pub impl<'self> Element {
pub fn new(type_id: ElementTypeId, tag_name: ~str) -> Element {
Element {
parent: Node::new(ElementNodeTypeId(type_id)),
Expand All @@ -121,7 +121,7 @@ pub impl Element {
}
}

fn get_attr(&self, name: &str) -> Option<&'self str> {
fn get_attr(&'self self, name: &str) -> Option<&'self str> {
// FIXME: Need an each() that links lifetimes in Rust.
for uint::range(0, self.attrs.len()) |i| {
if eq_slice(self.attrs[i].name, name) {
Expand Down
4 changes: 2 additions & 2 deletions src/servo/html/hubbub_html_parser.rs
Expand Up @@ -211,7 +211,7 @@ pub fn parse_html(url: Url,
css_chan: Chan<Option<Stylesheet>>| {
css_link_listener(css_chan, css_port, resource_task2.clone());
};
let css_chan = SharedChan(css_chan);
let css_chan = SharedChan::new(css_chan);

// Spawn a JS parser to receive JavaScript.
let resource_task2 = resource_task.clone();
Expand All @@ -220,7 +220,7 @@ pub fn parse_html(url: Url,
js_chan: Chan<JSResult>| {
js_script_listener(js_chan, js_port, resource_task2.clone());
};
let js_chan = SharedChan(js_chan);
let js_chan = SharedChan::new(js_chan);

let url2 = url.clone(), url3 = url.clone();

Expand Down
6 changes: 3 additions & 3 deletions src/servo/layout/box.rs
Expand Up @@ -113,8 +113,8 @@ pub fn RenderBoxData(node: AbstractNode, ctx: @mut FlowContext, id: int) -> Rend
}
}

impl RenderBox {
fn d(&mut self) -> &'self mut RenderBoxData {
impl<'self> RenderBox {
fn d(&'self mut self) -> &'self mut RenderBoxData {
unsafe {
//Rust #5074 - we can't take mutable references to the
// data that needs to be returned right now.
Expand Down Expand Up @@ -351,7 +351,7 @@ impl RenderBox {
self.content_box()
}

fn style(&mut self) -> CompleteStyle<'self> {
fn style(&'self mut self) -> CompleteStyle<'self> {
let d: &'self mut RenderBoxData = self.d();
d.node.style()
}
Expand Down
10 changes: 5 additions & 5 deletions src/servo/layout/flow.rs
Expand Up @@ -96,8 +96,8 @@ pub fn FlowData(id: int) -> FlowData {
}
}

pub impl FlowContext {
fn d(&mut self) -> &'self mut FlowData {
pub impl<'self> FlowContext {
fn d(&'self mut self) -> &'self mut FlowData {
unsafe {
match *self {
AbsoluteFlow(ref d) => cast::transmute(d),
Expand All @@ -111,21 +111,21 @@ pub impl FlowContext {
}
}

fn inline(&mut self) -> &'self mut InlineFlowData {
fn inline(&'self mut self) -> &'self mut InlineFlowData {
match self {
&InlineFlow(_, ref i) => unsafe { cast::transmute(i) },
_ => fail!(fmt!("Tried to access inline data of non-inline: f%d", self.d().id))
}
}

fn block(&mut self) -> &'self mut BlockFlowData {
fn block(&'self mut self) -> &'self mut BlockFlowData {
match self {
&BlockFlow(_, ref mut b) => unsafe { cast::transmute(b) },
_ => fail!(fmt!("Tried to access block data of non-block: f%d", self.d().id))
}
}

fn root(&mut self) -> &'self mut RootFlowData {
fn root(&'self mut self) -> &'self mut RootFlowData {
match self {
&RootFlow(_, ref r) => unsafe { cast::transmute(r) },
_ => fail!(fmt!("Tried to access root data of non-root: f%d", self.d().id))
Expand Down
2 changes: 1 addition & 1 deletion src/servo/layout/layout_task.rs
Expand Up @@ -86,7 +86,7 @@ pub struct BuildData {
pub fn LayoutTask(render_task: RenderTask,
img_cache_task: ImageCacheTask,
opts: Opts) -> LayoutTask {
SharedChan(spawn_listener::<Msg>(|from_content| {
SharedChan::new(spawn_listener::<Msg>(|from_content| {
let mut layout = Layout(render_task.clone(), img_cache_task.clone(), from_content, &opts);
layout.start();
}))
Expand Down
2 changes: 1 addition & 1 deletion src/servo/platform/osmain.rs
Expand Up @@ -56,7 +56,7 @@ pub enum Msg {
pub fn OSMain(dom_event_chan: comm::SharedChan<Event>, opts: Opts) -> OSMain {
let dom_event_chan = Cell(dom_event_chan);
OSMain {
chan: SharedChan(on_osmain::<Msg>(|po| {
chan: SharedChan::new(on_osmain::<Msg>(|po| {
let po = Cell(po);
do platform::runmain {
debug!("preparing to enter main loop");
Expand Down
2 changes: 1 addition & 1 deletion src/servo/servo.rc
Expand Up @@ -135,7 +135,7 @@ fn run(opts: &Opts) {

fn run_pipeline_screen(opts: &Opts) {
let (dom_event_port, dom_event_chan) = comm::stream();
let dom_event_chan = comm::SharedChan(dom_event_chan);
let dom_event_chan = comm::SharedChan::new(dom_event_chan);

// The platform event handler thread
let osmain = OSMain(dom_event_chan.clone(), copy *opts);
Expand Down

0 comments on commit 21e8ba6

Please sign in to comment.