Update Rust version again

This gets us the new runtime.
This commit is contained in:
Keegan McAllister 2013-08-12 11:03:07 -07:00
parent ef50acfa89
commit a2d9810b69
49 changed files with 129 additions and 129 deletions

@ -1 +1 @@
Subproject commit 29ffbbaaa850d3f8fe1b35e3a63defe9206a3eb7
Subproject commit 0a677bcf6e359f6f013a7e580ef467b5f389e5b7

View file

@ -156,7 +156,7 @@ impl<E> DisplayItem<E> {
}
}
fn base<'a>(&'a self) -> &'a BaseDisplayItem<E> {
pub fn base<'a>(&'a self) -> &'a BaseDisplayItem<E> {
// FIXME(tkuehn): Workaround for Rust region bug.
unsafe {
match *self {
@ -168,7 +168,7 @@ impl<E> DisplayItem<E> {
}
}
fn bounds(&self) -> Rect<Au> {
pub fn bounds(&self) -> Rect<Au> {
self.base().bounds
}
}

View file

@ -57,12 +57,12 @@ pub type FractionalPixel = float;
pub type FontTableTag = u32;
trait FontTableTagConversions {
pub fn tag_to_str(&self) -> ~str;
pub trait FontTableTagConversions {
fn tag_to_str(&self) -> ~str;
}
impl FontTableTagConversions for FontTableTag {
pub fn tag_to_str(&self) -> ~str {
fn tag_to_str(&self) -> ~str {
unsafe {
let reversed = str::raw::from_buf_len(cast::transmute(self), 4);
return str::from_chars([reversed.char_at(3),
@ -301,7 +301,7 @@ impl Font {
return Ok(Font::new_from_adopted_handle(fctx, styled_handle, style, backend, profiler_chan));
}
priv fn get_shaper(@mut self) -> @Shaper {
fn get_shaper(@mut self) -> @Shaper {
// fast path: already created a shaper
match self.shaper {
Some(shaper) => { return shaper; },
@ -332,7 +332,7 @@ impl Font {
// TODO: this should return a borrowed pointer, but I can't figure
// out why borrowck doesn't like my implementation.
priv fn get_azure_font(&mut self) -> AzScaledFontRef {
fn get_azure_font(&mut self) -> AzScaledFontRef {
// fast path: we've already created the azure font resource
match self.azure_font {
Some(ref azfont) => return azfont.get_ref(),
@ -346,14 +346,14 @@ impl Font {
}
#[cfg(target_os="macos")]
priv fn create_azure_font(&mut self) -> ScaledFont {
fn create_azure_font(&mut self) -> ScaledFont {
let cg_font = self.handle.get_CGFont();
let size = self.style.pt_size as AzFloat;
ScaledFont::new(self.backend, &cg_font, size)
}
#[cfg(target_os="linux")]
priv fn create_azure_font(&self) -> ScaledFont {
fn create_azure_font(&self) -> ScaledFont {
let freetype_font = self.handle.face;
let size = self.style.pt_size as AzFloat;
ScaledFont::new(self.backend, freetype_font, size)
@ -392,7 +392,7 @@ impl Font {
for (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) {
for (_i, glyph) in glyphs.iter_glyphs_for_char_range(&slice_range) {
let glyph_advance = glyph.advance_();
let glyph_advance = glyph.advance();
let glyph_offset = glyph.offset().unwrap_or_default(Au::zero_point());
let azglyph = struct__AzGlyph {
@ -432,7 +432,7 @@ impl Font {
let mut advance = Au(0);
for (glyphs, _offset, slice_range) in run.iter_slices_for_range(range) {
for (_i, glyph) in glyphs.iter_glyphs_for_char_range(&slice_range) {
advance = advance + glyph.advance_();
advance = advance + glyph.advance();
}
}
RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent)
@ -444,7 +444,7 @@ impl Font {
-> RunMetrics {
let mut advance = Au(0);
for (_i, glyph) in glyphs.iter_glyphs_for_char_range(slice_range) {
advance = advance + glyph.advance_();
advance = advance + glyph.advance();
}
RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent)
}

View file

@ -72,7 +72,7 @@ impl<'self> FontContext {
}
}
priv fn get_font_list(&'self self) -> &'self FontList {
fn get_font_list(&'self self) -> &'self FontList {
self.font_list.get_ref()
}
@ -110,7 +110,7 @@ impl<'self> FontContext {
}
}
priv fn transform_family(&self, family: &str) -> ~str {
fn transform_family(&self, family: &str) -> ~str {
// FIXME: Need a find_like() in HashMap.
let family = family.to_str();
debug!("(transform family) searching for `%s`", family);
@ -120,7 +120,7 @@ impl<'self> FontContext {
}
}
priv fn create_font_group(&mut self, style: &SpecifiedFontStyle) -> @FontGroup {
fn create_font_group(&mut self, style: &SpecifiedFontStyle) -> @FontGroup {
let mut fonts = ~[];
debug!("(create font group) --- starting ---");
@ -182,7 +182,7 @@ impl<'self> FontContext {
@FontGroup::new(style.families.to_managed(), &used_style, fonts)
}
priv fn create_font_instance(&self, desc: &FontDescriptor) -> Result<@mut Font, ()> {
fn create_font_instance(&self, desc: &FontDescriptor) -> Result<@mut Font, ()> {
return match &desc.selector {
// TODO(Issue #174): implement by-platform-name font selectors.
&SelectorPlatformIdentifier(ref identifier) => {

View file

@ -42,7 +42,7 @@ impl FontList {
list
}
priv fn refresh(&mut self, _: &FontContextHandle) {
fn refresh(&mut self, _: &FontContextHandle) {
// TODO(Issue #186): don't refresh unless something actually
// changed. Does OSX have a notification for this event?
//
@ -76,7 +76,7 @@ impl FontList {
result
}
priv fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> {
fn find_family(&self, family_name: &str) -> Option<@mut FontFamily> {
// look up canonical name
let family = self.family_map.find_equiv(&family_name);

View file

@ -35,7 +35,7 @@ pub use gfx_font_list = font_list;
pub use servo_gfx_font = font;
pub use servo_gfx_font_list = font_list;
priv mod render_context;
mod render_context;
// Rendering
pub mod color;

View file

@ -73,7 +73,7 @@ impl Drop for FontHandle {
}
impl FontHandleMethods for FontHandle {
pub fn new_from_buffer(fctx: &FontContextHandle,
fn new_from_buffer(fctx: &FontContextHandle,
buf: ~[u8],
style: &SpecifiedFontStyle)
-> Result<FontHandle, ()> {
@ -178,7 +178,7 @@ impl FontHandleMethods for FontHandle {
}
}
pub fn glyph_index(&self,
fn glyph_index(&self,
codepoint: char) -> Option<GlyphIndex> {
assert!(self.face.is_not_null());
unsafe {
@ -192,7 +192,7 @@ impl FontHandleMethods for FontHandle {
}
}
pub fn glyph_h_advance(&self,
fn glyph_h_advance(&self,
glyph: GlyphIndex) -> Option<FractionalPixel> {
assert!(self.face.is_not_null());
unsafe {
@ -213,7 +213,7 @@ impl FontHandleMethods for FontHandle {
}
}
pub fn get_metrics(&self) -> FontMetrics {
fn get_metrics(&self) -> FontMetrics {
/* TODO(Issue #76): complete me */
let face = self.get_face_rec();
@ -242,7 +242,7 @@ impl FontHandleMethods for FontHandle {
}
impl<'self> FontHandle {
priv fn set_char_size(face: FT_Face, pt_size: float) -> Result<(), ()>{
fn set_char_size(face: FT_Face, pt_size: float) -> Result<(), ()>{
let char_width = float_to_fixed_ft(pt_size) as FT_F26Dot6;
let char_height = float_to_fixed_ft(pt_size) as FT_F26Dot6;
let h_dpi = 72;
@ -262,7 +262,7 @@ impl<'self> FontHandle {
let mut face: FT_Face = ptr::null();
let face_index = 0 as FT_Long;
do file.as_c_str |file_str| {
do file.to_c_str().with_ref |file_str| {
FT_New_Face(ft_ctx, file_str,
face_index, ptr::to_mut_unsafe_ptr(&mut face));
}
@ -289,7 +289,7 @@ impl<'self> FontHandle {
let mut face: FT_Face = ptr::null();
let face_index = 0 as FT_Long;
do file.as_c_str |file_str| {
do file.to_c_str().with_ref |file_str| {
FT_New_Face(ft_ctx, file_str,
face_index, ptr::to_mut_unsafe_ptr(&mut face));
}
@ -305,13 +305,13 @@ impl<'self> FontHandle {
}
}
priv fn get_face_rec(&'self self) -> &'self FT_FaceRec {
fn get_face_rec(&'self self) -> &'self FT_FaceRec {
unsafe {
&(*self.face)
}
}
priv fn font_units_to_au(&self, value: float) -> Au {
fn font_units_to_au(&self, value: float) -> Au {
let face = self.get_face_rec();
// face.size is a *c_void in the bindings, presumably to avoid

View file

@ -26,7 +26,7 @@ use platform::font_context::FontContextHandle;
use std::hashmap::HashMap;
use std::libc;
use std::libc::c_int;
use std::libc::{c_int, c_char};
use std::ptr;
use std::str;
@ -48,9 +48,9 @@ impl FontListHandle {
let font = (*fontSet).fonts.offset(i);
let family: *FcChar8 = ptr::null();
let mut v: c_int = 0;
do "family".as_c_str |FC_FAMILY| {
do "family".to_c_str().with_ref |FC_FAMILY| {
while FcPatternGetString(*font, FC_FAMILY, v, &family) == FcResultMatch {
let family_name = str::raw::from_buf(family as *u8);
let family_name = str::raw::from_c_str(family as *c_char);
debug!("Creating new FontFamily for family: %s", family_name);
let new_family = @mut FontFamily::new(family_name);
family_map.insert(family_name, new_family);
@ -70,8 +70,8 @@ impl FontListHandle {
let font_set_array_ptr = ptr::to_unsafe_ptr(&font_set);
let pattern = FcPatternCreate();
assert!(pattern.is_not_null());
do "family".as_c_str |FC_FAMILY| {
do family.family_name.as_c_str |family_name| {
do "family".to_c_str().with_ref |FC_FAMILY| {
do family.family_name.to_c_str().with_ref |family_name| {
let ok = FcPatternAddString(pattern, FC_FAMILY, family_name as *FcChar8);
assert!(ok != 0);
}
@ -80,10 +80,10 @@ impl FontListHandle {
let object_set = FcObjectSetCreate();
assert!(object_set.is_not_null());
do "file".as_c_str |FC_FILE| {
do "file".to_c_str().with_ref |FC_FILE| {
FcObjectSetAdd(object_set, FC_FILE);
}
do "index".as_c_str |FC_INDEX| {
do "index".to_c_str().with_ref |FC_INDEX| {
FcObjectSetAdd(object_set, FC_INDEX);
}
@ -93,7 +93,7 @@ impl FontListHandle {
for i in range(0, (*matches).nfont as int) {
let font = (*matches).fonts.offset(i);
let file = do "file".as_c_str |FC_FILE| {
let file = do "file".to_c_str().with_ref |FC_FILE| {
let file: *FcChar8 = ptr::null();
if FcPatternGetString(*font, FC_FILE, 0, &file) == FcResultMatch {
str::raw::from_c_str(file as *libc::c_char)
@ -101,7 +101,7 @@ impl FontListHandle {
fail!();
}
};
let index = do "index".as_c_str |FC_INDEX| {
let index = do "index".to_c_str().with_ref |FC_INDEX| {
let index: libc::c_int = 0;
if FcPatternGetInteger(*font, FC_INDEX, 0, &index) == FcResultMatch {
index
@ -150,8 +150,8 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
let config = FcConfigGetCurrent();
let wrapper = AutoPattern { pattern: FcPatternCreate() };
let pattern = wrapper.pattern;
let res = do "family".as_c_str |FC_FAMILY| {
do name.as_c_str |family| {
let res = do "family".to_c_str().with_ref |FC_FAMILY| {
do name.to_c_str().with_ref |family| {
FcPatternAddString(pattern, FC_FAMILY, family as *FcChar8)
}
};
@ -161,7 +161,7 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
}
if style.italic {
let res = do "slant".as_c_str |FC_SLANT| {
let res = do "slant".to_c_str().with_ref |FC_SLANT| {
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC)
};
if res != 1 {
@ -170,7 +170,7 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
}
}
if style.weight.is_bold() {
let res = do "weight".as_c_str |FC_WEIGHT| {
let res = do "weight".to_c_str().with_ref |FC_WEIGHT| {
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD)
};
if res != 1 {
@ -193,13 +193,13 @@ pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, (
}
let file: *FcChar8 = ptr::null();
let res = do "file".as_c_str |FC_FILE| {
let res = do "file".to_c_str().with_ref |FC_FILE| {
FcPatternGetString(result_pattern, FC_FILE, 0, &file)
};
if res != FcResultMatch {
debug!("getting filename for font failed");
return Err(());
}
Ok(str::raw::from_buf(file as *u8))
Ok(str::raw::from_c_str(file as *c_char))
}
}

View file

@ -71,7 +71,7 @@ impl RenderChan {
}
}
priv struct RenderTask<C> {
struct RenderTask<C> {
id: PipelineId,
port: Port<Msg>,
compositor: C,

View file

@ -461,7 +461,7 @@ enum GlyphInfo<'self> {
}
impl<'self> GlyphInfo<'self> {
fn index(self) -> GlyphIndex {
pub fn index(self) -> GlyphIndex {
match self {
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].index(),
DetailGlyphInfo(store, entry_i, detail_j) => {
@ -472,7 +472,7 @@ impl<'self> GlyphInfo<'self> {
#[inline(always)]
// FIXME: Resolution conflicts with IteratorUtil trait so adding trailing _
fn advance_(self) -> Au {
pub fn advance(self) -> Au {
match self {
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].advance(),
DetailGlyphInfo(store, entry_i, detail_j) => {
@ -481,7 +481,7 @@ impl<'self> GlyphInfo<'self> {
}
}
fn offset(self) -> Option<Point2D<Au>> {
pub fn offset(self) -> Option<Point2D<Au>> {
match self {
SimpleGlyphInfo(_, _) => None,
DetailGlyphInfo(store, entry_i, detail_j) => {
@ -490,14 +490,14 @@ impl<'self> GlyphInfo<'self> {
}
}
fn is_ligature_start(self) -> bool {
pub fn is_ligature_start(self) -> bool {
match self {
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_ligature_start(),
DetailGlyphInfo(store, entry_i, _) => store.entry_buffer[entry_i].is_ligature_start()
}
}
fn is_cluster_start(self) -> bool {
pub fn is_cluster_start(self) -> bool {
match self {
SimpleGlyphInfo(store, entry_i) => store.entry_buffer[entry_i].is_cluster_start(),
DetailGlyphInfo(store, entry_i, _) => store.entry_buffer[entry_i].is_cluster_start()

View file

@ -197,7 +197,7 @@ impl CompositorLayer {
}
};
self.children.mut_iter().filter(|x| !x.child.hidden)
.transform(transform)
.map(transform)
.fold(false, |a, b| a || b) || redisplay
}
@ -219,7 +219,7 @@ impl CompositorLayer {
}
// ID does not match any of our immediate children, so recurse on descendents (including hidden children)
self.children.mut_iter().transform(|x| &mut x.child).any(|x| x.set_clipping_rect(pipeline_id, new_rect))
self.children.mut_iter().map(|x| &mut x.child).any(|x| x.set_clipping_rect(pipeline_id, new_rect))
}
@ -349,7 +349,7 @@ impl CompositorLayer {
return true;
}
// ID does not match ours, so recurse on descendents (including hidden children).
self.children.mut_iter().transform(|x| &mut x.child).any(|x| x.add_buffers(pipeline_id, new_buffers))
self.children.mut_iter().map(|x| &mut x.child).any(|x| x.add_buffers(pipeline_id, new_buffers))
}
// Deletes a specified sublayer, including hidden children. Returns false if the layer is not found.
@ -362,7 +362,7 @@ impl CompositorLayer {
true
}
None => {
self.children.mut_iter().transform(|x| &mut x.child).any(|x| x.delete(pipeline_id))
self.children.mut_iter().map(|x| &mut x.child).any(|x| x.delete(pipeline_id))
}
}
}

View file

@ -47,7 +47,7 @@ struct QuadtreeNode<T> {
tile_mem: uint,
}
priv enum Quadrant {
enum Quadrant {
TL = 0,
TR = 1,
BL = 2,

View file

@ -49,7 +49,7 @@ struct FrameTree {
// Need to clone the FrameTrees, but _not_ the Pipelines
impl Clone for FrameTree {
fn clone(&self) -> FrameTree {
let mut children = do self.children.iter().transform |&frame_tree| {
let mut children = do self.children.iter().map |&frame_tree| {
@mut (*frame_tree).clone()
};
FrameTree {
@ -113,7 +113,7 @@ impl FrameTree {
fn to_sendable(&self) -> SendableFrameTree {
let sendable_frame_tree = SendableFrameTree {
pipeline: (*self.pipeline).clone(),
children: self.children.iter().transform(|frame_tree| frame_tree.to_sendable()).collect(),
children: self.children.iter().map(|frame_tree| frame_tree.to_sendable()).collect(),
};
sendable_frame_tree
}
@ -202,7 +202,7 @@ impl NavigationContext {
let from_prev = do self.previous.iter().filter_map |frame_tree| {
frame_tree.find_mut(pipeline_id)
};
from_prev.chain_(from_current).chain_(from_next).collect()
from_prev.chain(from_current).chain(from_next).collect()
}
pub fn contains(&mut self, pipeline_id: PipelineId) -> bool {
@ -210,7 +210,7 @@ impl NavigationContext {
let from_next = self.next.iter();
let from_prev = self.previous.iter();
let mut all_contained = from_prev.chain_(from_current).chain_(from_next);
let mut all_contained = from_prev.chain(from_current).chain(from_next);
do all_contained.any |frame_tree| {
frame_tree.contains(pipeline_id)
}
@ -337,7 +337,7 @@ impl Constellation {
let matching_pending_frames = do self.pending_frames.iter().filter_map |frame_change| {
frame_change.after.find_mut(source_pipeline_id)
};
matching_navi_frames.consume_iter().chain_(matching_pending_frames).collect()
matching_navi_frames.move_iter().chain(matching_pending_frames).collect()
};
if frame_trees.is_empty() {

View file

@ -37,7 +37,7 @@ impl LayoutData {
/// Functionality useful for querying the layout-specific data on DOM nodes.
pub trait LayoutAuxMethods {
fn layout_data(self) -> @mut LayoutData;
pub fn has_layout_data(self) -> bool;
fn has_layout_data(self) -> bool;
fn set_layout_data(self, data: @mut LayoutData);
fn initialize_layout_data(self) -> Option<@mut LayoutData>;
@ -45,17 +45,17 @@ pub trait LayoutAuxMethods {
}
impl LayoutAuxMethods for AbstractNode<LayoutView> {
pub fn layout_data(self) -> @mut LayoutData {
fn layout_data(self) -> @mut LayoutData {
unsafe {
self.unsafe_layout_data()
}
}
pub fn has_layout_data(self) -> bool {
fn has_layout_data(self) -> bool {
unsafe {
self.unsafe_has_layout_data()
}
}
pub fn set_layout_data(self, data: @mut LayoutData) {
fn set_layout_data(self, data: @mut LayoutData) {
unsafe {
self.unsafe_set_layout_data(data)
}

View file

@ -124,7 +124,7 @@ impl BlockFlowData {
/// Computes left and right margins and width based on CSS 2.1 secion 10.3.3.
/// Requires borders and padding to already be computed
priv fn compute_horiz( &self,
fn compute_horiz( &self,
width: MaybeAuto,
left_margin: MaybeAuto,
right_margin: MaybeAuto,

View file

@ -383,7 +383,7 @@ impl RenderBox {
//
// TODO(eatkinson): integrate with
// get_min_width and get_pref_width?
priv fn guess_width (&self) -> Au {
fn guess_width (&self) -> Au {
do self.with_base |base| {
if(!base.node.is_element()) {
Au(0)
@ -820,7 +820,7 @@ impl RenderBox {
self.nearest_ancestor_element().style().text_align()
}
fn line_height(&self) -> CSSLineHeight {
pub fn line_height(&self) -> CSSLineHeight {
self.nearest_ancestor_element().style().line_height()
}

View file

@ -60,7 +60,7 @@ enum InlineSpacerSide {
LogicalAfter,
}
priv fn simulate_UA_display_rules(node: AbstractNode<LayoutView>) -> CSSDisplay {
fn simulate_UA_display_rules(node: AbstractNode<LayoutView>) -> CSSDisplay {
// FIXME
/*let resolved = do node.aux |nd| {
match nd.style.display_type {

View file

@ -83,7 +83,7 @@ impl FlowContext {
//
// FIXME: Unify this with traverse_preorder_prune, which takes a separate
// 'prune' function.
fn partially_traverse_preorder(&self, callback: &fn(FlowContext) -> bool) {
pub fn partially_traverse_preorder(&self, callback: &fn(FlowContext) -> bool) {
if !callback((*self).clone()) {
return;
}
@ -94,7 +94,7 @@ impl FlowContext {
}
}
fn traverse_bu_sub_inorder (&self, callback: &fn(FlowContext)) {
pub fn traverse_bu_sub_inorder (&self, callback: &fn(FlowContext)) {
for kid in self.children() {
// FIXME: Work around rust#2202. We should be able to pass the callback directly.
kid.traverse_bu_sub_inorder(|a| callback(a));

View file

@ -25,7 +25,7 @@ static THROBBER: [char, ..8] = [ '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯'
pub struct Application;
impl ApplicationMethods for Application {
pub fn new() -> Application {
fn new() -> Application {
glfw::init();
Application
}

View file

@ -56,8 +56,8 @@ pub mod compositing;
pub mod macros;
pub mod css {
priv mod select_handler;
priv mod node_util;
mod select_handler;
mod node_util;
pub mod select;
pub mod matching;

View file

@ -51,21 +51,21 @@ pub trait ApplicationMethods {
pub trait WindowMethods<A> {
/// Creates a new window.
pub fn new(app: &A) -> @mut Self;
fn new(app: &A) -> @mut Self;
/// Returns the size of the window.
pub fn size(&self) -> Size2D<f32>;
fn size(&self) -> Size2D<f32>;
/// Presents the window to the screen (perhaps by page flipping).
pub fn present(&mut self);
fn present(&mut self);
/// Spins the event loop and returns the next event.
pub fn recv(@mut self) -> WindowEvent;
fn recv(@mut self) -> WindowEvent;
/// Sets the ready state of the current page.
pub fn set_ready_state(@mut self, ready_state: ReadyState);
fn set_ready_state(@mut self, ready_state: ReadyState);
/// Sets the render state of the current page.
pub fn set_render_state(@mut self, render_state: RenderState);
fn set_render_state(@mut self, render_state: RenderState);
/// Returns the hidpi factor of the monitor.
pub fn hidpi_factor(@mut self) -> f32;
fn hidpi_factor(@mut self) -> f32;
}

View file

@ -232,18 +232,18 @@ impl ImageCache {
}
}
priv fn get_state(&self, url: Url) -> ImageState {
fn get_state(&self, url: Url) -> ImageState {
match self.state_map.find(&url) {
Some(state) => *state,
None => Init
}
}
priv fn set_state(&self, url: Url, state: ImageState) {
fn set_state(&self, url: Url, state: ImageState) {
self.state_map.insert(url, state);
}
priv fn prefetch(&self, url: Url) {
fn prefetch(&self, url: Url) {
match self.get_state(url.clone()) {
Init => {
let to_cache = self.chan.clone();
@ -274,7 +274,7 @@ impl ImageCache {
}
}
priv fn store_prefetched_image_data(&self, url: Url, data: Result<Cell<~[u8]>, ()>) {
fn store_prefetched_image_data(&self, url: Url, data: Result<Cell<~[u8]>, ()>) {
match self.get_state(url.clone()) {
Prefetching(next_step) => {
match data {
@ -303,7 +303,7 @@ impl ImageCache {
}
}
priv fn decode(&self, url: Url) {
fn decode(&self, url: Url) {
match self.get_state(url.clone()) {
Init => fail!(~"decoding image before prefetch"),
@ -346,7 +346,7 @@ impl ImageCache {
}
}
priv fn store_image(&self, url: Url, image: Option<Arc<~Image>>) {
fn store_image(&self, url: Url, image: Option<Arc<~Image>>) {
match self.get_state(url.clone()) {
Decoding => {
@ -373,7 +373,7 @@ impl ImageCache {
}
priv fn purge_waiters(&self, url: Url, f: &fn() -> ImageResponseMsg) {
fn purge_waiters(&self, url: Url, f: &fn() -> ImageResponseMsg) {
match self.wait_map.pop(&url) {
Some(waiters) => {
for response in waiters.iter() {
@ -384,7 +384,7 @@ impl ImageCache {
}
}
priv fn get_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
fn get_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
match self.get_state(url.clone()) {
Init => fail!(~"request for image before prefetch"),
Prefetching(DoDecode) => response.send(ImageNotReady),
@ -395,7 +395,7 @@ impl ImageCache {
}
}
priv fn wait_for_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
fn wait_for_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
match self.get_state(url.clone()) {
Init => fail!(~"request for image before prefetch"),

View file

@ -33,7 +33,7 @@ pub struct LocalImageCache {
priv state_map: UrlMap<@mut ImageState>
}
priv struct ImageState {
struct ImageState {
prefetched: bool,
decoded: bool,
last_request_round: uint,
@ -133,7 +133,7 @@ impl LocalImageCache {
return port;
}
priv fn get_state(&self, url: &Url) -> @mut ImageState {
fn get_state(&self, url: &Url) -> @mut ImageState {
let state = do self.state_map.find_or_insert_with(url.clone()) |_| {
let new_state = @mut ImageState {
prefetched: false,

View file

@ -3935,7 +3935,7 @@ class CGDOMJSProxyHandler_obj_toString(CGAbstractExternMethod):
JSString* jsresult;
return xpc_qsStringToJsstring(cx, result, &jsresult) ? jsresult : NULL;"""
return """ do "%s".as_c_str |s| {
return """ do "%s".to_c_str().with_ref |s| {
_obj_toString(cx, s)
}""" % self.descriptor.name
@ -4461,9 +4461,9 @@ class CGDictionary(CGThing):
# NOTE: jsids are per-runtime, so don't use them in workers
if True or self.workers: #XXXjdm hack until 'static mut' exists for global jsids
propName = member.identifier.name
propCheck = ('"%s".as_c_str(|s| { JS_HasProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&found)) })' %
propCheck = ('"%s".to_c_str().with_ref(|s| { JS_HasProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&found)) })' %
propName)
propGet = ('"%s".as_c_str(|s| { JS_GetProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&temp)) })' %
propGet = ('"%s".to_c_str().with_ref(|s| { JS_GetProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&temp)) })' %
propName)
else:
propId = self.makeIdName(member.identifier.name);

View file

@ -54,7 +54,7 @@ pub extern fn trace(tracer: *mut JSTracer, obj: *JSObject) {
unsafe {
(*tracer).debugPrinter = ptr::null();
(*tracer).debugPrintIndex = -1;
do name.as_c_str |name| {
do name.to_c_str().with_ref |name| {
(*tracer).debugPrintArg = name as *libc::c_void;
JS_CallTracer(cast::transmute(tracer), wrapper, JSTRACE_OBJECT as u32);
}

View file

@ -68,7 +68,7 @@ pub extern fn defineProperty(cx: *JSContext, proxy: *JSObject, id: jsid,
pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
unsafe {
let name = str::raw::from_buf(className as *u8);
let name = str::raw::from_c_str(className);
let nchars = "[object ]".len() + name.len();
let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as u64 * (size_of::<jschar>() as u64)));
if chars.is_null() {

View file

@ -202,7 +202,7 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal) -> Result<~str, ()> {
}
let strbuf = JS_EncodeString(cx, jsstr);
let buf = str::raw::from_buf(strbuf as *u8);
let buf = str::raw::from_c_str(strbuf);
JS_free(cx, strbuf as *libc::c_void);
Ok(buf)
}
@ -454,7 +454,7 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
let mut interface = ptr::null();
if constructorClass.is_not_null() || constructor.is_not_null() {
interface = do name.as_c_str |s| {
interface = do name.to_c_str().with_ref |s| {
CreateInterfaceObject(cx, global, receiver, constructorClass,
constructor, ctorNargs, proto,
staticMethods, constants, s)
@ -506,7 +506,7 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
}
if constructorClass.is_not_null() {
let toString = do "toString".as_c_str |s| {
let toString = do "toString".to_c_str().with_ref |s| {
DefineFunctionWithReserved(cx, constructor, s,
InterfaceObjectToString,
0, 0)

View file

@ -115,7 +115,7 @@ impl Document {
}
impl WrappableDocument for Document {
pub fn init_wrapper(@mut self, cx: *JSContext) {
fn init_wrapper(@mut self, cx: *JSContext) {
self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice
}
}

View file

@ -43,7 +43,7 @@ impl HTMLDocument {
}
impl WrappableDocument for HTMLDocument {
pub fn init_wrapper(@mut self, cx: *JSContext) {
fn init_wrapper(@mut self, cx: *JSContext) {
self.wrap_object_shared(cx, ptr::null()); //XXXjdm a proper scope would be nice
}
}

View file

@ -463,7 +463,7 @@ impl<'self, View> AbstractNode<View> {
}
impl<View> Iterator<AbstractNode<View>> for AbstractNodeChildrenIterator<View> {
pub fn next(&mut self) -> Option<AbstractNode<View>> {
fn next(&mut self) -> Option<AbstractNode<View>> {
let node = self.current_node;
self.current_node = self.current_node.chain(|node| node.next_sibling());
node

View file

@ -62,7 +62,7 @@ impl DocumentDamageLevel {
///
/// FIXME(pcwalton): This could be refactored to use `max` and the `Ord` trait, and this
/// function removed.
fn add(&mut self, new_damage: DocumentDamageLevel) {
pub fn add(&mut self, new_damage: DocumentDamageLevel) {
match (*self, new_damage) {
(ReflowDocumentDamage, new_damage) => *self = new_damage,
(MatchSelectorsDocumentDamage, _) => *self = MatchSelectorsDocumentDamage,

View file

@ -756,7 +756,7 @@ impl ScriptTask {
}
}
priv fn load_url_from_element(&self, page: @mut Page, element: &Element) {
fn load_url_from_element(&self, page: @mut Page, element: &Element) {
// if the node's element is "a," load url from href attr
let attr = element.get_attr("href");
for href in attr.iter() {

View file

@ -70,7 +70,7 @@ impl ProfilerCategory {
// enumeration of all ProfilerCategory types
// TODO(tkuehn): is there a better way to ensure proper order of categories?
priv fn empty_buckets() -> ProfilerBuckets {
fn empty_buckets() -> ProfilerBuckets {
let buckets = [
(CompositingCategory, ~[]),
(LayoutQueryCategory, ~[]),
@ -92,7 +92,7 @@ impl ProfilerCategory {
}
// ensure that the order of the buckets matches the order of the enum categories
priv fn check_order(vec: &ProfilerBuckets) {
fn check_order(vec: &ProfilerBuckets) {
for &(category, _) in vec.iter() {
if category != vec[category as uint].first() {
fail!("Enum category does not match bucket index. This is a bug.");
@ -136,7 +136,7 @@ impl Profiler {
}
}
priv fn handle_msg(&mut self, msg: ProfilerMsg) {
fn handle_msg(&mut self, msg: ProfilerMsg) {
match msg {
TimeMsg(category, t) => match self.buckets[category as uint] {
//TODO(tkuehn): would be nice to have tuple.second_mut()
@ -151,7 +151,7 @@ impl Profiler {
self.last_msg = Some(msg);
}
priv fn print_buckets(&mut self) {
fn print_buckets(&mut self) {
println(fmt!("%31s %15s %15s %15s %15s %15s",
"_category_", "_mean (ms)_", "_median (ms)_",
"_min (ms)_", "_max (ms)_", "_bucket size_"));
@ -163,7 +163,7 @@ impl Profiler {
let data_len = data.len();
if data_len > 0 {
let (mean, median, &min, &max) =
(data.iter().transform(|&x|x).sum() / (data_len as float),
(data.iter().map(|&x|x).sum() / (data_len as float),
data[data_len / 2],
data.iter().min().unwrap(),
data.iter().max().unwrap());

View file

@ -7,13 +7,13 @@
// Macros to make add_child etc. less painful to write.
// Code outside this module should instead implement TreeNode
// and use its default methods.
priv macro_rules! get(
macro_rules! get(
($node:expr, $fun:ident) => (
TreeNodeRef::$fun::<Node,Self>($node)
)
)
priv macro_rules! set(
macro_rules! set(
($node:expr, $fun:ident, $val:expr) => (
TreeNodeRef::$fun::<Node,Self>($node, $val)
)
@ -44,7 +44,7 @@ pub struct TreeIterator<Ref> {
}
impl<Ref> TreeIterator<Ref> {
priv fn new(nodes: ~[Ref]) -> TreeIterator<Ref> {
fn new(nodes: ~[Ref]) -> TreeIterator<Ref> {
TreeIterator {
nodes: nodes,
index: 0,
@ -220,8 +220,8 @@ pub trait TreeNodeRef<Node>: Clone {
}
}
priv fn gather<Node, Ref: TreeNodeRef<Node>>(cur: &Ref, refs: &mut ~[Ref],
postorder: bool, prune: &fn(&Ref) -> bool) {
fn gather<Node, Ref: TreeNodeRef<Node>>(cur: &Ref, refs: &mut ~[Ref],
postorder: bool, prune: &fn(&Ref) -> bool) {
// prune shouldn't mutate, so don't clone
if prune(cur) {
return;

View file

@ -43,7 +43,7 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
path.push(p.to_str());
}
let path = path.init();
let mut path = path.iter().transform(|x| (*x).clone()).collect::<~[~str]>();
let mut path = path.iter().map(|x| (*x).clone()).collect::<~[~str]>();
path.push(str_url);
let path = path.connect("/");

@ -1 +1 @@
Subproject commit 68875af396cb583e670dd5caad99431dac62f8db
Subproject commit 4e9340d2549d0f62468254809b59d833c2e82595

@ -1 +1 @@
Subproject commit 113e2c37ad772511c473010c4d944459689778a8
Subproject commit 4e883bc2754d9d3b1ba21baa0603dd43b093cffd

@ -1 +1 @@
Subproject commit 1c5e9e74b2857c254a8a0743747bffab6c059331
Subproject commit b66cc67a1fa0a5a85eefdb0073d29e410f34f1f2

@ -1 +1 @@
Subproject commit fc4a1cc0ff62aba5a32a66eee5dc087f11daa552
Subproject commit 3e2179942cb679a4f08c81674f4f8e4777f88cff

@ -1 +1 @@
Subproject commit 5b9a447946b736802a0791eb1c24687849ad3984
Subproject commit 690f9062746e1fed5e0f027acc1b095db6b50c6f

@ -1 +1 @@
Subproject commit 6d634549f24c87629cfa3401159b67a5766d5b67
Subproject commit 41e63b6856b21ee21549dcb98618404d088513bc

@ -1 +1 @@
Subproject commit 4c6a69ad0f074d4e03cd25d8cf753e8559712c3e
Subproject commit 065db559d51051bd786836e2aba9c0bef4031ad7

@ -1 +1 @@
Subproject commit cbd5e01469797b5f12df6679ff11365a3d4c34d5
Subproject commit e036183e152542cb2080e5b098b66efce1decf5a

@ -1 +1 @@
Subproject commit 93df6bd75c5ecd13855ea73be83d3c9a2d5d9d03
Subproject commit 9ea9b1411e0b98358c757e27eb026aac2c5948b2

@ -1 +1 @@
Subproject commit 795d0d6e5a9c8645f738d36111ef23021e646870
Subproject commit 69de03ef7e447d22593eb3e405257b07ff38aa71

@ -1 +1 @@
Subproject commit 8850fa10cdea9218be0fb470a6de3691766fa094
Subproject commit 73f46084428a37021e7d0d77daaa7b8a18fface3

@ -1 +1 @@
Subproject commit f634f6c5e6de7c3ef4ad62f28d36ea94e782b095
Subproject commit f19be6340c2d3fa9a12a53889ba5021a8f155073

@ -1 +1 @@
Subproject commit d9854ec23b9c6348c0b3fef38fe1890124391b8b
Subproject commit ae5fe3138298d276656715f5fdef021ce0a98c99

@ -1 +1 @@
Subproject commit 14a02310b547ee91126c0761b041be04edacd7da
Subproject commit caa31c98eee0334b5881f6ced37ccee4eba7d28c