servo: Update for nocopy changes
authorBrian Anderson <banderson@mozilla.com>
Sat, 26 May 2012 15:20:42 -0700
changeset 470750 b058752bdaf9c05c985d59be8cc76561f5778301
parent 470749 46b6f664c954425ae0bae371baf885e923745c69
child 470751 659da69befda4101eab3d98a9db9e84cdea6759b
push id44079
push userbmo:gps@mozilla.com
push dateSat, 04 Feb 2017 00:14:49 +0000
servo: Update for nocopy changes Source-Repo: https://github.com/servo/servo Source-Revision: 9bb970d3859134370890ac2a1cfd2f79d1ff609c
servo/src/servo/gfx/renderer.rs
servo/src/servo/gfx/surface.rs
servo/src/servo/layout/base.rs
servo/src/servo/layout/box_builder.rs
servo/src/servo/layout/layout.rs
servo/src/servo/layout/style/style.rs
servo/src/servo/layout/text.rs
servo/src/servo/platform/osmain.rs
servo/src/servo/text/glyph.rs
--- a/servo/src/servo/gfx/renderer.rs
+++ b/servo/src/servo/gfx/renderer.rs
@@ -49,17 +49,17 @@ fn renderer<S: sink send copy>(sink: S) 
 impl to_float for u8 {
     fn to_float() -> float {
         (self as float) / 255f
     }
 }
 
 fn draw_solid_color(draw_target: AzDrawTargetRef, item: dl::display_item,
                     r: u8, g: u8, b: u8) {
-    let bounds = (*item).bounds;
+    let bounds = copy (*item).bounds;
 
     let red_color = {
         r: r.to_float() as AzFloat,
         g: g.to_float() as AzFloat,
         b: b.to_float() as AzFloat,
         a: 1f as AzFloat
     };
     let red_pattern = AzCreateColorPattern(ptr::addr_of(red_color));
@@ -78,17 +78,17 @@ fn draw_solid_color(draw_target: AzDrawT
 
     AzReleaseColorPattern(red_pattern);
 }
 
 fn draw_image(draw_target: AzDrawTargetRef, item: dl::display_item,
               -image: ~image) {
     // FIXME: This is hideously inefficient.
 
-    let bounds = (*item).bounds;
+    let bounds = copy (*item).bounds;
 
     if (image.depth < 3u) {
         #debug("TODO: can't draw images with depth less than 3 yet");
         ret;
     }
 
     let stride = image.width * image.depth;
     for uint::range(0u, image.height) {
--- a/servo/src/servo/gfx/surface.rs
+++ b/servo/src/servo/gfx/surface.rs
@@ -17,14 +17,14 @@ impl format for format {
         alt self {
             fo_rgba_8888 { 32u }
         }
     }
 }
 
 fn image_surface(size: geom::size<int>, format: format) -> image_surface {
     {
-        size: size,
+        size: copy size,
         format: format,
         buffer: vec::from_elem((size.area() as uint) * format.bpp(), 0u8)
     }
 }
 
--- a/servo/src/servo/layout/base.rs
+++ b/servo/src/servo/layout/base.rs
@@ -96,17 +96,17 @@ impl layout_methods for @box {
             bk_inline { self.reflow_inline(available_width) }
             bk_intrinsic(size) { self.reflow_intrinsic(*size) }
             bk_text(subbox) { self.reflow_text(available_width, subbox) }
         }
     }
 
     #[doc="The trivial reflow routine for instrinsically-sized frames."]
     fn reflow_intrinsic(size: geom::size<au>) {
-        self.bounds.size = size;
+        self.bounds.size = copy size;
 
         #debug["reflow_intrinsic size=%?", self.bounds];
     }
 
     #[doc="Dumps the box tree, for debugging."]
     fn dump() {
         self.dump_indent(0u);
     }
@@ -118,17 +118,17 @@ impl node_methods_priv for node {
     #[doc="Dumps the node tree, for debugging, with indentation."]
     fn dump_indent(indent: uint) {
         let mut s = "";
         for uint::range(0u, indent) {
             |_i|
             s += "    ";
         }
 
-        s += #fmt("%?", self.rd({ |n| n.kind }));
+        s += #fmt("%?", self.rd({ |n| copy n.kind }));
         #debug["%s", s];
 
         for ntree.each_child(self) { |kid| kid.dump_indent(indent + 1u) }
     }
 }
 
 impl node_methods for node {
     #[doc="Dumps the subtree rooted at this node, for debugging."]
--- a/servo/src/servo/layout/box_builder.rs
+++ b/servo/src/servo/layout/box_builder.rs
@@ -144,22 +144,22 @@ impl methods for ctxt {
 }
 
 impl box_builder_priv for node {
     #[doc="
         Determines the kind of box that this node needs. Also, for images,
         computes the intrinsic size.
     "]
     fn determine_box_kind() -> box_kind {
-        alt self.rd({ |n| n.kind }) {
+        alt self.rd({ |n| copy n.kind }) {
             ~nk_text(string) { bk_text(@text_box(string)) }
             ~nk_element(element) {
                 alt *element.subclass {
                     es_div       { bk_block            }
-                    es_img(size) { bk_intrinsic(@size) }
+                    es_img(size) { bk_intrinsic(@copy size) }
                     es_unknown   { bk_inline           }
                 }
             }
         }
     }
 }
 
 impl box_builder_methods for node {
--- a/servo/src/servo/layout/layout.rs
+++ b/servo/src/servo/layout/layout.rs
@@ -61,25 +61,25 @@ fn build_display_list(box: @base::box) -
 }
 
 fn box_to_display_item(box: @base::box) -> dl::display_item {
 	let mut item;
 	alt box.appearance.background_image {
 		some(image) {
 			item = dl::display_item({
 				item_type: dl::display_item_image(~copy *image),
-				bounds: box.bounds
+				bounds: copy box.bounds
 			});
 		}
 		none {
 			let r = rand::rng();
 			item = dl::display_item({
 				item_type: dl::display_item_solid_color(r.next() as u8,
 														r.next() as u8,
 														r.next() as u8),
-				bounds: box.bounds
+				bounds: copy box.bounds
 			});
 		}
 	}
 
 	#debug("layout: display item: %?", item);
     ret item;
 }
--- a/servo/src/servo/layout/style/style.rs
+++ b/servo/src/servo/layout/style/style.rs
@@ -38,17 +38,17 @@ impl style_priv for node {
         Performs CSS selector matching on a node.
         
         This is, importantly, the function that creates the layout data for
         the node (the reader-auxiliary box in the RCU model) and populates it
         with the computed style.
     "]
     fn recompute_style() {
         let default_style: computed_style =
-            default_style_for_node_kind(self.rd { |n| *n.kind });
+            default_style_for_node_kind(self.rd { |n| copy *n.kind });
 
         #debug("recomputing style; parent node:");
 
         let the_layout_data = @layout_data({
             mut computed_style: default_style,
             mut box: none
         });
 
@@ -64,17 +64,17 @@ impl style_methods for node {
         has not yet been performed, fails.
 
         TODO: Return a safe reference; don't copy.
     "]
     fn get_computed_style() -> computed_style {
         if !self.has_aux() {
             fail "get_computed_style() called on a node without a style!";
         }
-        ret self.aux({ |x| x }).computed_style;
+        ret copy self.aux({ |x| copy x }).computed_style;
     }
 
     #[doc="
         Performs CSS selector matching on a subtree.
 
         This is, importantly, the function that creates the layout data for
         the node (the reader-auxiliary box in the RCU model) and populates it
         with the computed style.
--- a/servo/src/servo/layout/text.rs
+++ b/servo/src/servo/layout/text.rs
@@ -18,17 +18,17 @@ class text_box {
 impl text_layout_methods for @box {
     fn reflow_text(_available_width: au, subbox: @text_box) {
         alt self.kind {
             bk_text(*) { /* ok */ }
             _ { fail "expected text box in reflow_text!" }
         };
 
         let run = text_run(subbox.text);
-        subbox.run = some(run);
+        subbox.run = some(copy run);
         run.shape();
 
         self.bounds.size = {
             mut width:
                 alt vec::last_opt(run.glyphs.get()) {
                     some(glyph) {
                         au(*glyph.pos.offset.x + *glyph.pos.advance.x)
                     }
--- a/servo/src/servo/platform/osmain.rs
+++ b/servo/src/servo/platform/osmain.rs
@@ -193,17 +193,17 @@ fn mk_surface() -> surface {
 fn destroy_surface(surface: surface) {
     AzReleaseDrawTarget(surface.az_target);
     cairo_surface_destroy(surface.cairo_surf);
     sdl::video::unlock_surface(surface.sdl_surf);
     sdl::video::free_surface(surface.sdl_surf);
 }
 
 #[doc = "A function for spawning into the platform's main thread"]
-fn on_osmain<T: send>(f: fn~(comm::port<T>)) -> comm::chan<T> {
+fn on_osmain<T: send>(+f: fn~(comm::port<T>)) -> comm::chan<T> {
     let builder = task::builder();
     let opts = {
         sched: some({
             mode: task::osmain,
             native_stack_size: none
         })
         with task::get_opts(builder)
     };
--- a/servo/src/servo/text/glyph.rs
+++ b/servo/src/servo/text/glyph.rs
@@ -19,12 +19,12 @@ class glyph_pos {
 
 #[doc="A single glyph."]
 class glyph {
     let codepoint: uint;
     let pos: glyph_pos;
 
     new(codepoint: uint, pos: glyph_pos) {
         self.codepoint = codepoint;
-        self.pos = pos;
+        self.pos = copy pos;
     }
 }