Merge pull request #384 from luqmana/update

Update for language changes.
This commit is contained in:
Brian Anderson 2013-04-20 14:47:55 -07:00
commit 4eccaf31c8
23 changed files with 50 additions and 47 deletions

@ -1 +1 @@
Subproject commit 783392f70fcfd6770782796bef06bed47043cabf Subproject commit 2b09267b762398a3c851ecfd55d5d01aee906352

@ -1 +1 @@
Subproject commit a8ebe76090dd67f24a9da41404878f5316afbf6a Subproject commit 556c56eac1843120f6ce6c58a2de116b4c214c27

@ -1 +1 @@
Subproject commit 6ce668e09fb378643bb37d1ec5338fa09a8a4d3d Subproject commit edfb494a1a28d9e3e779ee521d2925bc3244664a

@ -1 +1 @@
Subproject commit 5ca8bdfcdbb4c715cd22136f582f2b81df9c7adb Subproject commit a65a9768384d0ef06f47049fb639aab312ee453a

@ -1 +1 @@
Subproject commit 1afc08b508d4980342a715a5d3faef63ac4389c3 Subproject commit 6a338951c6a8bf76b235f64f3903da84dac0b705

View file

@ -34,8 +34,8 @@ pub enum DisplayItem {
Border(DisplayItemData, Au, Color) Border(DisplayItemData, Au, Color)
} }
pub impl DisplayItem { pub impl<'self> DisplayItem {
fn d(&self) -> &'self DisplayItemData { fn d(&'self self) -> &'self DisplayItemData {
match *self { match *self {
SolidColor(ref d, _) => d, SolidColor(ref d, _) => d,
Text(ref d, _, _, _) => d, Text(ref d, _, _, _) => d,

View file

@ -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() self.font_list.get_ref()
} }

View file

@ -52,15 +52,17 @@ pub fn RenderTask<C:Compositor + Owned>(compositor: C, opts: Opts) -> RenderTask
f f
}; };
Renderer { // FIXME: rust/#5967
let mut r = Renderer {
port: po, port: po,
compositor: compositor, 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, thread_pool: thread_pool,
opts: opts_cell.take() 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. /// Data that needs to be kept around for each render thread.
@ -79,7 +81,7 @@ priv struct Renderer<C> {
} }
impl<C: Compositor + Owned> Renderer<C> { impl<C: Compositor + Owned> Renderer<C> {
fn start(&self) { fn start(&mut self) {
debug!("renderer: beginning rendering loop"); debug!("renderer: beginning rendering loop");
loop { loop {
@ -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"); debug!("renderer: got render request");
let layer_buffer_set_port = self.layer_buffer_set_port.take(); let layer_buffer_set_port = self.layer_buffer_set_port.take();

View file

@ -12,7 +12,7 @@ pub fn factory() -> LoaderTask {
let f: LoaderTask = |url, progress_chan| { let f: LoaderTask = |url, progress_chan| {
assert!(url.scheme == ~"http"); assert!(url.scheme == ~"http");
let progress_chan = SharedChan(progress_chan); let progress_chan = SharedChan::new(progress_chan);
do spawn { do spawn {
debug!("http_loader: requesting via http: %?", url.clone()); debug!("http_loader: requesting via http: %?", url.clone());
let mut request = uv_http_request(url.clone()); let mut request = uv_http_request(url.clone());

View file

@ -96,7 +96,7 @@ pub fn ImageCacheTask_(resource_task: ResourceTask,
let decoder_factory_cell = Cell(decoder_factory); let decoder_factory_cell = Cell(decoder_factory);
let (port, chan) = stream(); let (port, chan) = stream();
let chan = SharedChan(chan); let chan = SharedChan::new(chan);
let port_cell = Cell(port); let port_cell = Cell(port);
let chan_cell = Cell(chan.clone()); let chan_cell = Cell(chan.clone());
@ -140,7 +140,7 @@ fn SyncImageCacheTask(resource_task: ResourceTask) -> ImageCacheTask {
} }
} }
return SharedChan(chan); return SharedChan::new(chan);
} }
struct ImageCache { struct ImageCache {

View file

@ -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 // TODO: change copy to move once we can move out of closures
ResourceManager(from_client, loaders_cell.take()).start() ResourceManager(from_client, loaders_cell.take()).start()
}; };
SharedChan(chan) SharedChan::new(chan)
} }
pub struct ResourceManager { pub struct ResourceManager {

View file

@ -306,7 +306,7 @@ struct DetailedGlyphStore {
lookup_is_sorted: bool, lookup_is_sorted: bool,
} }
impl DetailedGlyphStore { impl<'self> DetailedGlyphStore {
fn new() -> DetailedGlyphStore { fn new() -> DetailedGlyphStore {
DetailedGlyphStore { DetailedGlyphStore {
detail_buffer: ~[], // TODO: default size? detail_buffer: ~[], // TODO: default size?
@ -339,7 +339,7 @@ impl DetailedGlyphStore {
self.lookup_is_sorted = false; 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] { -> &'self [DetailedGlyph] {
debug!("Requesting detailed glyphs[n=%u] for entry[off=%u]", count as uint, entry_offset); debug!("Requesting detailed glyphs[n=%u] for entry[off=%u]", count as uint, entry_offset);
@ -369,7 +369,7 @@ impl DetailedGlyphStore {
} }
} }
fn get_detailed_glyph_with_index(&self, fn get_detailed_glyph_with_index(&'self self,
entry_offset: uint, entry_offset: uint,
detail_offset: u16) detail_offset: u16)
-> &'self DetailedGlyph { -> &'self DetailedGlyph {
@ -507,7 +507,7 @@ pub struct GlyphStore {
detail_store: DetailedGlyphStore, detail_store: DetailedGlyphStore,
} }
pub impl GlyphStore { pub impl<'self> GlyphStore {
// Initializes the glyph store, but doesn't actually shape anything. // Initializes the glyph store, but doesn't actually shape anything.
// Use the set_glyph, set_glyphs() methods to store glyph data. // Use the set_glyph, set_glyphs() methods to store glyph data.
fn new(length: uint) -> GlyphStore { fn new(length: uint) -> GlyphStore {
@ -585,7 +585,7 @@ pub impl GlyphStore {
self.entry_buffer[i] = entry; self.entry_buffer[i] = entry;
} }
fn iter_glyphs_for_char_index(&self, fn iter_glyphs_for_char_index(&'self self,
i: uint, i: uint,
cb: &fn(uint, &GlyphInfo<'self>) -> bool) cb: &fn(uint, &GlyphInfo<'self>) -> bool)
-> bool { -> bool {
@ -609,7 +609,8 @@ pub impl GlyphStore {
true 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() { if range.begin() >= self.entry_buffer.len() {
error!("iter_glyphs_for_range: range.begin beyond length!"); error!("iter_glyphs_for_range: range.begin beyond length!");
return; return;
@ -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| { for uint::range(0, self.entry_buffer.len()) |i| {
if !self.iter_glyphs_for_char_index(i, cb) { if !self.iter_glyphs_for_char_index(i, cb) {
break; break;

View file

@ -37,7 +37,7 @@ impl SendableTextRun {
} }
} }
pub impl TextRun { pub impl<'self> TextRun {
fn new(font: @mut Font, text: ~str) -> TextRun { fn new(font: @mut Font, text: ~str) -> TextRun {
let mut glyph_store = GlyphStore::new(str::char_len(text)); let mut glyph_store = GlyphStore::new(str::char_len(text));
TextRun::compute_potential_breaks(text, &mut glyph_store); TextRun::compute_potential_breaks(text, &mut glyph_store);
@ -102,7 +102,7 @@ pub impl TextRun {
} }
fn char_len(&self) -> uint { self.glyphs.entry_buffer.len() } 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 { fn range_is_trimmable_whitespace(&self, range: &Range) -> bool {
for range.eachi |i| { for range.eachi |i| {

View file

@ -4,12 +4,12 @@
use core::cmp::{Ord, Eq}; 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(&self, key: &T) -> Option<&'self T>;
fn binary_search_index(&self, key: &T) -> Option<uint>; 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> { fn binary_search(&self, key: &T) -> Option<&'self T> {
match self.binary_search_index(key) { match self.binary_search_index(key) {
None => None, None => None,

View file

@ -60,7 +60,7 @@ pub fn ContentTask(layout_task: LayoutTask,
-> ContentTask { -> ContentTask {
let (control_port, control_chan) = comm::stream(); 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_chan_copy = control_chan.clone();
let control_port = Cell(control_port); let control_port = Cell(control_port);
let dom_event_port = Cell(dom_event_port); let dom_event_port = Cell(dom_event_port);

View file

@ -10,11 +10,11 @@ use newcss::complete::CompleteStyle;
/// Node mixin providing `style` method that returns a `NodeStyle` /// Node mixin providing `style` method that returns a `NodeStyle`
pub trait StyledNode { pub trait StyledNode {
fn style(&self) -> CompleteStyle<'self>; fn style<'a>(&'a self) -> CompleteStyle<'a>;
} }
impl StyledNode for AbstractNode { 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 assert!(self.is_element()); // Only elements can have styles
let results = self.get_css_select_results(); let results = self.get_css_select_results();
results.computed_style() results.computed_style()

View file

@ -112,7 +112,7 @@ pub struct HTMLImageElement {
// Element methods // Element methods
// //
pub impl Element { pub impl<'self> Element {
pub fn new(type_id: ElementTypeId, tag_name: ~str) -> Element { pub fn new(type_id: ElementTypeId, tag_name: ~str) -> Element {
Element { Element {
parent: Node::new(ElementNodeTypeId(type_id)), parent: Node::new(ElementNodeTypeId(type_id)),
@ -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. // FIXME: Need an each() that links lifetimes in Rust.
for uint::range(0, self.attrs.len()) |i| { for uint::range(0, self.attrs.len()) |i| {
if eq_slice(self.attrs[i].name, name) { if eq_slice(self.attrs[i].name, name) {

View file

@ -211,7 +211,7 @@ pub fn parse_html(url: Url,
css_chan: Chan<Option<Stylesheet>>| { css_chan: Chan<Option<Stylesheet>>| {
css_link_listener(css_chan, css_port, resource_task2.clone()); 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. // Spawn a JS parser to receive JavaScript.
let resource_task2 = resource_task.clone(); let resource_task2 = resource_task.clone();
@ -220,7 +220,7 @@ pub fn parse_html(url: Url,
js_chan: Chan<JSResult>| { js_chan: Chan<JSResult>| {
js_script_listener(js_chan, js_port, resource_task2.clone()); 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(); let url2 = url.clone(), url3 = url.clone();

View file

@ -113,8 +113,8 @@ pub fn RenderBoxData(node: AbstractNode, ctx: @mut FlowContext, id: int) -> Rend
} }
} }
impl RenderBox { impl<'self> RenderBox {
fn d(&mut self) -> &'self mut RenderBoxData { fn d(&'self mut self) -> &'self mut RenderBoxData {
unsafe { unsafe {
//Rust #5074 - we can't take mutable references to the //Rust #5074 - we can't take mutable references to the
// data that needs to be returned right now. // data that needs to be returned right now.
@ -351,7 +351,7 @@ impl RenderBox {
self.content_box() self.content_box()
} }
fn style(&mut self) -> CompleteStyle<'self> { fn style(&'self mut self) -> CompleteStyle<'self> {
let d: &'self mut RenderBoxData = self.d(); let d: &'self mut RenderBoxData = self.d();
d.node.style() d.node.style()
} }

View file

@ -96,8 +96,8 @@ pub fn FlowData(id: int) -> FlowData {
} }
} }
pub impl FlowContext { pub impl<'self> FlowContext {
fn d(&mut self) -> &'self mut FlowData { fn d(&'self mut self) -> &'self mut FlowData {
unsafe { unsafe {
match *self { match *self {
AbsoluteFlow(ref d) => cast::transmute(d), AbsoluteFlow(ref d) => cast::transmute(d),
@ -111,21 +111,21 @@ pub impl FlowContext {
} }
} }
fn inline(&mut self) -> &'self mut InlineFlowData { fn inline(&'self mut self) -> &'self mut InlineFlowData {
match self { match self {
&InlineFlow(_, ref i) => unsafe { cast::transmute(i) }, &InlineFlow(_, ref i) => unsafe { cast::transmute(i) },
_ => fail!(fmt!("Tried to access inline data of non-inline: f%d", self.d().id)) _ => 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 { match self {
&BlockFlow(_, ref mut b) => unsafe { cast::transmute(b) }, &BlockFlow(_, ref mut b) => unsafe { cast::transmute(b) },
_ => fail!(fmt!("Tried to access block data of non-block: f%d", self.d().id)) _ => 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 { match self {
&RootFlow(_, ref r) => unsafe { cast::transmute(r) }, &RootFlow(_, ref r) => unsafe { cast::transmute(r) },
_ => fail!(fmt!("Tried to access root data of non-root: f%d", self.d().id)) _ => fail!(fmt!("Tried to access root data of non-root: f%d", self.d().id))

View file

@ -86,7 +86,7 @@ pub struct BuildData {
pub fn LayoutTask(render_task: RenderTask, pub fn LayoutTask(render_task: RenderTask,
img_cache_task: ImageCacheTask, img_cache_task: ImageCacheTask,
opts: Opts) -> LayoutTask { 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); let mut layout = Layout(render_task.clone(), img_cache_task.clone(), from_content, &opts);
layout.start(); layout.start();
})) }))

View file

@ -56,7 +56,7 @@ pub enum Msg {
pub fn OSMain(dom_event_chan: comm::SharedChan<Event>, opts: Opts) -> OSMain { pub fn OSMain(dom_event_chan: comm::SharedChan<Event>, opts: Opts) -> OSMain {
let dom_event_chan = Cell(dom_event_chan); let dom_event_chan = Cell(dom_event_chan);
OSMain { OSMain {
chan: SharedChan(on_osmain::<Msg>(|po| { chan: SharedChan::new(on_osmain::<Msg>(|po| {
let po = Cell(po); let po = Cell(po);
do platform::runmain { do platform::runmain {
debug!("preparing to enter main loop"); debug!("preparing to enter main loop");

View file

@ -135,7 +135,7 @@ fn run(opts: &Opts) {
fn run_pipeline_screen(opts: &Opts) { fn run_pipeline_screen(opts: &Opts) {
let (dom_event_port, dom_event_chan) = comm::stream(); 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 // The platform event handler thread
let osmain = OSMain(dom_event_chan.clone(), copy *opts); let osmain = OSMain(dom_event_chan.clone(), copy *opts);