Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for language changes. #384

Merged
merged 1 commit into from Apr 20, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Update for language changes.

  • Loading branch information
luqmana committed Apr 20, 2013
commit 21e8ba6c8a1b4a03e1ecfebf26d9864507368590
Submodule rust updated from 783392 to 2b0926
@@ -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,
@@ -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()
}

@@ -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.
@@ -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 {
@@ -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();
@@ -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());
@@ -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());

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

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

struct ImageCache {
@@ -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 {
@@ -306,7 +306,7 @@ struct DetailedGlyphStore {
lookup_is_sorted: bool,
}

impl DetailedGlyphStore {
impl<'self> DetailedGlyphStore {
fn new() -> DetailedGlyphStore {
DetailedGlyphStore {
detail_buffer: ~[], // TODO: default size?
@@ -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);

@@ -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 {
@@ -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 {
@@ -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 {
@@ -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;
@@ -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;
@@ -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);
@@ -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| {
@@ -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,
@@ -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);
@@ -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()
@@ -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)),
@@ -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) {
@@ -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();
@@ -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();

@@ -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.
@@ -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()
}
@@ -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),
@@ -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))
@@ -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();
}))
@@ -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");
@@ -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);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.