Trait changes, and eliminate 'copy'

This commit is contained in:
Keegan McAllister 2013-08-09 13:41:10 -07:00
parent 907d9f23cf
commit ffe60ea027
30 changed files with 111 additions and 100 deletions

View file

@ -183,7 +183,7 @@ impl FontGroup {
pub fn new(families: @str, style: &UsedFontStyle, fonts: ~[@mut Font]) -> FontGroup {
FontGroup {
families: families,
style: copy *style,
style: (*style).clone(),
fonts: fonts,
}
}
@ -264,7 +264,7 @@ impl Font {
handle: handle,
azure_font: None,
shaper: None,
style: copy *style,
style: (*style).clone(),
metrics: metrics,
backend: backend,
profiler_chan: profiler_chan,
@ -281,7 +281,7 @@ impl Font {
handle: handle,
azure_font: None,
shaper: None,
style: copy *style,
style: (*style).clone(),
metrics: metrics,
backend: backend,
profiler_chan: profiler_chan,
@ -387,7 +387,7 @@ impl Font {
fields: 0x0200 as uint16_t
};
let mut origin = copy baseline_origin;
let mut origin = baseline_origin.clone();
let mut azglyphs = ~[];
azglyphs.reserve(range.length());
@ -462,7 +462,7 @@ impl Font {
}
pub fn get_descriptor(&self) -> FontDescriptor {
FontDescriptor::new(copy self.style, SelectorPlatformIdentifier(self.handle.face_identifier()))
FontDescriptor::new(self.style.clone(), SelectorPlatformIdentifier(self.handle.face_identifier()))
}
pub fn glyph_index(&self, codepoint: char) -> Option<GlyphIndex> {

View file

@ -117,7 +117,7 @@ impl<'self> FontContext {
debug!("(transform family) searching for `%s`", family);
match self.generic_fonts.find(&family) {
None => family,
Some(mapped_family) => copy *mapped_family
Some(mapped_family) => (*mapped_family).clone()
}
}
@ -142,7 +142,7 @@ impl<'self> FontContext {
let font_id =
SelectorPlatformIdentifier(font_entry.handle.face_identifier());
let font_desc = FontDescriptor::new(copy *style, font_id);
let font_desc = FontDescriptor::new((*style).clone(), font_id);
let instance = self.get_font_by_descriptor(&font_desc);
@ -164,7 +164,7 @@ impl<'self> FontContext {
for result.iter().advance |font_entry| {
let font_id =
SelectorPlatformIdentifier(font_entry.handle.face_identifier());
let font_desc = FontDescriptor::new(copy *style, font_id);
let font_desc = FontDescriptor::new((*style).clone(), font_id);
let instance = self.get_font_by_descriptor(&font_desc);
@ -176,7 +176,7 @@ impl<'self> FontContext {
assert!(fonts.len() > 0);
// TODO(Issue #179): Split FontStyle into specified and used styles
let used_style = copy *style;
let used_style = (*style).clone();
debug!("(create font group) --- finished ---");
@ -187,8 +187,8 @@ impl<'self> FontContext {
return match &desc.selector {
// TODO(Issue #174): implement by-platform-name font selectors.
&SelectorPlatformIdentifier(ref identifier) => {
let result_handle = self.handle.create_font_from_identifier(copy *identifier,
copy desc.style);
let result_handle = self.handle.create_font_from_identifier((*identifier).clone(),
desc.style.clone());
result::chain(result_handle, |handle| {
Ok(Font::new_from_adopted_handle(self,
handle,

View file

@ -39,13 +39,13 @@ pub fn from_cmdline_args(args: &[~str]) -> Opts {
let opt_match = match getopts::getopts(args, opts) {
result::Ok(m) => m,
result::Err(f) => fail!(getopts::fail_str(copy f)),
result::Err(f) => fail!(getopts::fail_str(f.clone())),
};
let urls = if opt_match.free.is_empty() {
fail!(~"servo asks that you provide 1 or more URLs")
} else {
copy opt_match.free
opt_match.free.clone()
};
let render_backend = match getopts::opt_maybe_str(&opt_match, "r") {

View file

@ -173,7 +173,7 @@ impl FontHandleMethods for FontHandle {
FontHandleMethods::new_from_buffer(fctx, buf.clone(), style)
}
FontSourceFile(ref file) => {
FontHandle::new_from_file(fctx, copy *file, style)
FontHandle::new_from_file(fctx, (*file).clone(), style)
}
}
}

View file

@ -39,6 +39,7 @@ pub enum Msg {
}
/// A request from the compositor to the renderer for tiles that need to be (re)displayed.
#[deriving(Clone)]
pub struct BufferRequest {
// The rect in pixels that will be drawn to the screen
screen_rect: Rect<uint>,
@ -112,7 +113,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
id: id,
port: port.take(),
compositor: compositor,
font_ctx: @mut FontContext::new(copy opts.render_backend,
font_ctx: @mut FontContext::new(opts.render_backend.clone(),
false,
profiler_chan.clone()),
opts: opts,

View file

@ -28,7 +28,7 @@ pub struct ImageSurface {
impl ImageSurface {
pub fn new(size: Size2D<int>, format: format) -> ImageSurface {
ImageSurface {
size: copy size,
size: size.clone(),
format: format,
buffer: vec::from_elem((size.area() as uint) * format.bpp(), 0u8)
}

View file

@ -25,6 +25,7 @@ use extra::sort;
/// In the uncommon case (multiple glyphs per unicode character, large glyph index/advance, or
/// glyph offsets), we pack the glyph count into GlyphEntry, and store the other glyph information
/// in DetailedGlyphStore.
#[deriving(Clone)]
struct GlyphEntry {
value: u32
}
@ -256,6 +257,7 @@ impl GlyphEntry {
// Stores data for a detailed glyph, in the case that several glyphs
// correspond to one character, or the glyph's data couldn't be packed.
#[deriving(Clone)]
struct DetailedGlyph {
index: GlyphIndex,
// glyph's advance, in the text's direction (RTL or RTL)
@ -274,7 +276,7 @@ impl DetailedGlyph {
}
}
#[deriving(Eq)]
#[deriving(Eq, Clone)]
struct DetailedGlyphRecord {
// source string offset/GlyphEntry offset in the TextRun
entry_offset: uint,

View file

@ -398,7 +398,7 @@ impl Shaper {
// cspan: [-]
// covsp: [---------------]
let mut covered_byte_span = copy char_byte_span;
let mut covered_byte_span = char_byte_span.clone();
// extend, clipping at end of text range.
while covered_byte_span.end() < byte_max
&& byteToGlyph[covered_byte_span.end()] == NO_GLYPH {

View file

@ -33,7 +33,7 @@ impl SendableTextRun {
};
TextRun {
text: copy self.text,
text: self.text.clone(),
font: font,
underline: self.underline,
glyphs: self.glyphs.clone(),
@ -115,7 +115,7 @@ impl<'self> TextRun {
pub fn serialize(&self) -> SendableTextRun {
SendableTextRun {
text: copy self.text,
text: self.text.clone(),
font: self.font.get_descriptor(),
underline: self.underline,
glyphs: self.glyphs.clone(),

View file

@ -227,7 +227,7 @@ impl Constellation {
profiler_chan: ProfilerChan)
-> ConstellationChan {
let opts = Cell::new(copy *opts);
let opts = Cell::new((*opts).clone());
let (constellation_port, constellation_chan) = special_stream!(ConstellationChan);
let constellation_port = Cell::new(constellation_port);
@ -304,7 +304,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
copy self.opts,
self.opts.clone(),
{
let size = self.compositor_chan.get_size();
from_value(Size2D(size.width as uint, size.height as uint))
@ -370,7 +370,7 @@ impl Constellation {
self.compositor_chan.clone(),
self.image_cache_task.clone(),
self.profiler_chan.clone(),
copy self.opts,
self.opts.clone(),
source_pipeline,
size_future)
} else {
@ -382,7 +382,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
copy self.opts,
self.opts.clone(),
size_future)
};
@ -438,7 +438,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
copy self.opts,
self.opts.clone(),
size_future);
if url.path.ends_with(".js") {

View file

@ -782,7 +782,7 @@ impl RenderBox {
// FIXME: Too much allocation here.
let font_families = do my_style.font_family().map |family| {
match *family {
CSSFontFamilyFamilyName(ref family_str) => copy *family_str,
CSSFontFamilyFamilyName(ref family_str) => (*family_str).clone(),
CSSFontFamilyGenericFamily(Serif) => ~"serif",
CSSFontFamilyGenericFamily(SansSerif) => ~"sans-serif",
CSSFontFamilyGenericFamily(Cursive) => ~"cursive",

View file

@ -269,7 +269,7 @@ impl BoxGenerator {
do node.with_imm_image_element |image_element| {
if image_element.image.is_some() {
// FIXME(pcwalton): Don't copy URLs.
let url = copy *image_element.image.get_ref();
let url = (*image_element.image.get_ref()).clone();
ImageRenderBoxClass(@mut ImageRenderBox::new(base, url, layout_ctx.image_cache))
} else {
info!("Tried to make image box, but couldn't find image. Made generic box \

View file

@ -10,6 +10,7 @@ use std::util::replace;
use std::vec;
use std::i32::max_value;
#[deriving(Clone)]
pub enum FloatType{
FloatLeft,
FloatRight
@ -28,6 +29,7 @@ struct FloatContextBase{
offset: Point2D<Au>
}
#[deriving(Clone)]
struct FloatData{
bounds: Rect<Au>,
f_type: FloatType

View file

@ -181,7 +181,7 @@ impl LayoutTask {
};
// FIXME: Bad copy!
let doc_url = copy data.url;
let doc_url = data.url.clone();
let script_chan = data.script_chan.clone();
debug!("layout: received layout request for: %s", doc_url.to_str());

View file

@ -50,7 +50,7 @@ pub trait UnscannedMethods {
impl UnscannedMethods for RenderBox {
fn raw_text(&self) -> ~str {
match *self {
UnscannedTextRenderBoxClass(text_box) => copy text_box.text,
UnscannedTextRenderBoxClass(text_box) => text_box.text.clone(),
_ => fail!(~"unsupported operation: box.raw_text() on non-unscanned text box."),
}
}

View file

@ -13,7 +13,7 @@ pub struct NodeRange {
impl NodeRange {
pub fn new(node: AbstractNode<LayoutView>, range: &Range) -> NodeRange {
NodeRange { node: node, range: copy *range }
NodeRange { node: node, range: (*range).clone() }
}
}

View file

@ -52,7 +52,7 @@ impl Pipeline {
RenderTask::create(id,
render_port,
compositor_chan.clone(),
copy opts,
opts.clone(),
profiler_chan.clone());
LayoutTask::create(id,
@ -61,7 +61,7 @@ impl Pipeline {
script_pipeline.script_chan.clone(),
render_chan.clone(),
image_cache_task.clone(),
copy opts,
opts.clone(),
profiler_chan);
let new_layout_info = NewLayoutInfo {
@ -109,7 +109,7 @@ impl Pipeline {
RenderTask::create(id,
render_port,
compositor_chan.clone(),
copy opts,
opts.clone(),
profiler_chan.clone());
LayoutTask::create(id,
@ -118,7 +118,7 @@ impl Pipeline {
script_chan.clone(),
render_chan.clone(),
image_cache_task,
copy opts,
opts.clone(),
profiler_chan);
Pipeline::new(id,
subpage_id,

View file

@ -157,6 +157,7 @@ struct ImageCache {
need_exit: Option<Chan<()>>,
}
#[deriving(Clone)]
enum ImageState {
Init,
Prefetching(AfterPrefetch),
@ -166,6 +167,7 @@ enum ImageState {
Failed
}
#[deriving(Clone)]
enum AfterPrefetch {
DoDecode,
DoNotDecode
@ -242,25 +244,25 @@ impl ImageCache {
}
priv fn prefetch(&self, url: Url) {
match self.get_state(copy url) {
match self.get_state(url.clone()) {
Init => {
let to_cache = self.chan.clone();
let resource_task = self.resource_task.clone();
let url_cell = Cell::new(copy url);
let url_cell = Cell::new(url.clone());
do spawn {
let url = url_cell.take();
debug!("image_cache_task: started fetch for %s", url.to_str());
let image = load_image_data(copy url, resource_task.clone());
let image = load_image_data(url.clone(), resource_task.clone());
let result = if image.is_ok() {
Ok(Cell::new(result::unwrap(image)))
} else {
Err(())
};
to_cache.send(StorePrefetchedImageData(copy url, result));
debug!("image_cache_task: ended fetch for %s", (copy url).to_str());
to_cache.send(StorePrefetchedImageData(url.clone(), result));
debug!("image_cache_task: ended fetch for %s", (url.clone()).to_str());
}
self.set_state(url, Prefetching(DoNotDecode));
@ -273,19 +275,19 @@ impl ImageCache {
}
priv fn store_prefetched_image_data(&self, url: Url, data: Result<Cell<~[u8]>, ()>) {
match self.get_state(copy url) {
match self.get_state(url.clone()) {
Prefetching(next_step) => {
match data {
Ok(data_cell) => {
let data = data_cell.take();
self.set_state(copy url, Prefetched(@Cell::new(data)));
self.set_state(url.clone(), Prefetched(@Cell::new(data)));
match next_step {
DoDecode => self.decode(url),
_ => ()
}
}
Err(*) => {
self.set_state(copy url, Failed);
self.set_state(url.clone(), Failed);
self.purge_waiters(url, || ImageFailed);
}
}
@ -302,7 +304,7 @@ impl ImageCache {
}
priv fn decode(&self, url: Url) {
match self.get_state(copy url) {
match self.get_state(url.clone()) {
Init => fail!(~"decoding image before prefetch"),
Prefetching(DoNotDecode) => {
@ -319,7 +321,7 @@ impl ImageCache {
let data = data_cell.take();
let to_cache = self.chan.clone();
let url_cell = Cell::new(copy url);
let url_cell = Cell::new(url.clone());
let decode = (self.decoder_factory)();
do spawn {
@ -331,7 +333,7 @@ impl ImageCache {
} else {
None
};
to_cache.send(StoreImage(copy url, image));
to_cache.send(StoreImage(url.clone(), image));
debug!("image_cache_task: ended image decode for %s", url.to_str());
}
@ -346,15 +348,15 @@ impl ImageCache {
priv fn store_image(&self, url: Url, image: Option<ARC<~Image>>) {
match self.get_state(copy url) {
match self.get_state(url.clone()) {
Decoding => {
match image {
Some(image) => {
self.set_state(copy url, Decoded(@image.clone()));
self.set_state(url.clone(), Decoded(@image.clone()));
self.purge_waiters(url, || ImageReady(image.clone()) );
}
None => {
self.set_state(copy url, Failed);
self.set_state(url.clone(), Failed);
self.purge_waiters(url, || ImageFailed );
}
}
@ -383,7 +385,7 @@ impl ImageCache {
}
priv fn get_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
match self.get_state(copy url) {
match self.get_state(url.clone()) {
Init => fail!(~"request for image before prefetch"),
Prefetching(DoDecode) => response.send(ImageNotReady),
Prefetching(DoNotDecode) | Prefetched(*) => fail!(~"request for image before decode"),
@ -394,7 +396,7 @@ impl ImageCache {
}
priv fn wait_for_image(&self, url: Url, response: Chan<ImageResponseMsg>) {
match self.get_state(copy url) {
match self.get_state(url.clone()) {
Init => fail!(~"request for image before prefetch"),
Prefetching(DoNotDecode) | Prefetched(*) => fail!(~"request for image before decode"),
@ -540,7 +542,7 @@ fn should_fail_if_requesting_image_before_requesting_decode() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Prefetch(url.clone()));
// no decode message
let (chan, _port) = stream();
@ -563,7 +565,7 @@ fn should_not_request_url_from_resource_task_on_multiple_prefetches() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Prefetch(url));
url_requested.recv();
image_cache_task.exit();
@ -586,8 +588,8 @@ fn should_return_image_not_ready_if_data_has_not_arrived() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
let (response_chan, response_port) = stream();
image_cache_task.send(GetImage(url, response_chan));
assert!(response_port.recv() == ImageNotReady);
@ -616,8 +618,8 @@ fn should_return_decoded_image_data_if_data_has_arrived() {
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_image_chan.recv();
@ -653,15 +655,15 @@ fn should_return_decoded_image_data_for_multiple_requests() {
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_image.recv();
for iter::repeat(2) {
let (response_chan, response_port) = stream();
image_cache_task.send(GetImage(copy url, response_chan));
image_cache_task.send(GetImage(url.clone(), response_chan));
match response_port.recv() {
ImageReady(_) => (),
_ => fail
@ -699,12 +701,12 @@ fn should_not_request_image_from_resource_task_if_image_is_already_available() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Prefetch(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
image_bin_sent.recv();
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.exit();
mock_resource_task.send(resource_task::Exit);
@ -743,14 +745,14 @@ fn should_not_request_image_from_resource_task_if_image_fetch_already_failed() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
image_bin_sent.recv();
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
image_cache_task.exit();
mock_resource_task.send(resource_task::Exit);
@ -783,8 +785,8 @@ fn should_return_failed_if_image_bin_cannot_be_fetched() {
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_prefetech.recv();
@ -821,14 +823,14 @@ fn should_return_failed_for_multiple_get_image_requests_if_image_bin_cannot_be_f
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_prefetech.recv();
let (response_chan, response_port) = stream();
image_cache_task.send(GetImage(copy url, response_chan));
image_cache_task.send(GetImage(url.clone(), response_chan));
match response_port.recv() {
ImageFailed => (),
_ => fail
@ -878,8 +880,8 @@ fn should_return_not_ready_if_image_is_still_decoding() {
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_prefetech.recv();
@ -921,8 +923,8 @@ fn should_return_failed_if_image_decode_fails() {
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_decode.recv();
@ -960,8 +962,8 @@ fn should_return_image_on_wait_if_image_is_already_loaded() {
}
}));
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
// Wait until our mock resource task has sent the image to the image cache
wait_for_decode.recv();
@ -990,8 +992,8 @@ fn should_return_image_on_wait_if_image_is_not_yet_loaded() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
let (response_chan, response_port) = stream();
image_cache_task.send(WaitForImage(url, response_chan));
@ -1020,8 +1022,8 @@ fn should_return_image_failed_on_wait_if_image_fails_to_load() {
let image_cache_task = ImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
let (response_chan, response_port) = stream();
image_cache_task.send(WaitForImage(url, response_chan));
@ -1047,8 +1049,8 @@ fn sync_cache_should_wait_for_images() {
let image_cache_task = SyncImageCacheTask(mock_resource_task);
let url = make_url(~"file", None);
image_cache_task.send(Prefetch(copy url));
image_cache_task.send(Decode(copy url));
image_cache_task.send(Prefetch(url.clone()));
image_cache_task.send(Decode(url.clone()));
let (response_chan, response_port) = stream();
image_cache_task.send(GetImage(url, response_chan));

View file

@ -51,7 +51,7 @@ impl LocalImageCache {
pub fn prefetch(&self, url: &Url) {
let state = self.get_state(url);
if !state.prefetched {
self.image_cache_task.send(Prefetch(copy *url));
self.image_cache_task.send(Prefetch((*url).clone()));
state.prefetched = true;
}
}
@ -59,7 +59,7 @@ impl LocalImageCache {
pub fn decode(&self, url: &Url) {
let state = self.get_state(url);
if !state.decoded {
self.image_cache_task.send(Decode(copy *url));
self.image_cache_task.send(Decode((*url).clone()));
state.decoded = true;
}
}
@ -97,7 +97,7 @@ impl LocalImageCache {
}
let (response_port, response_chan) = comm::stream();
self.image_cache_task.send(GetImage(copy *url, response_chan));
self.image_cache_task.send(GetImage((*url).clone(), response_chan));
let response = response_port.recv();
match response {
@ -110,10 +110,10 @@ impl LocalImageCache {
let image_cache_task = self.image_cache_task.clone();
assert!(self.on_image_available.is_some());
let on_image_available = self.on_image_available.get()();
let url = copy *url;
let url = (*url).clone();
do task::spawn {
let (response_port, response_chan) = comm::stream();
image_cache_task.send(WaitForImage(copy url, response_chan));
image_cache_task.send(WaitForImage(url.clone(), response_chan));
on_image_available(response_port.recv());
}
}

View file

@ -142,7 +142,7 @@ fn test_bad_scheme() {
fn should_delegate_to_scheme_loader() {
let payload = ~[1, 2, 3];
let loader_factory = |_url: Url, progress_chan: Chan<ProgressMsg>| {
progress_chan.send(Payload(copy payload));
progress_chan.send(Payload(payload.clone()));
progress_chan.send(Done(Ok(())));
};
let loader_factories = ~[(~"snicklefritz", loader_factory)];

View file

@ -273,7 +273,7 @@ extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
let node = unwrap(obj);
do node.with_imm_element |elem| {
let s = str(copy elem.tag_name);
let s = str(elem.tag_name.clone());
*vp = domstring_to_jsval(cx, &s);
}
}

View file

@ -392,6 +392,7 @@ pub struct JSNativeHolder {
propertyHooks: *NativePropertyHooks
}
#[deriving(Clone)]
pub enum ConstantVal {
IntVal(i32),
UintVal(u32),
@ -401,6 +402,7 @@ pub enum ConstantVal {
VoidVal
}
#[deriving(Clone)]
pub struct ConstantSpec {
name: *libc::c_char,
value: ConstantVal
@ -853,6 +855,7 @@ impl DerivedWrapper for AbstractNode<ScriptView> {
}
}
#[deriving(ToStr)]
pub enum Error {
FailureUnknown
}

View file

@ -23,7 +23,7 @@ impl CharacterData {
}
pub fn Data(&self) -> DOMString {
copy self.data
self.data.clone()
}
pub fn SetData(&mut self, arg: &DOMString, _rv: &mut ErrorResult) {

View file

@ -55,7 +55,7 @@ impl Event {
}
pub fn Type(&self) -> DOMString {
copy self.type_
self.type_.clone()
}
pub fn GetTarget(&self) -> Option<@mut EventTarget> {

View file

@ -28,8 +28,8 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance,
do task::spawn {
let url = do provenance_cell.with_ref |p| {
match *p {
UrlProvenance(ref the_url) => copy *the_url,
InlineProvenance(ref the_url, _) => copy *the_url
UrlProvenance(ref the_url) => (*the_url).clone(),
InlineProvenance(ref the_url, _) => (*the_url).clone()
}
};

View file

@ -185,7 +185,7 @@ fn js_script_listener(to_parent: SharedChan<HtmlDiscoveryMessage>,
do task::spawn {
let (input_port, input_chan) = comm::stream();
// TODO: change copy to move once we can move into closures
resource_task.send(Load(copy url, input_chan));
resource_task.send(Load(url.clone(), input_chan));
let mut buf = ~[];
loop {
@ -403,7 +403,7 @@ pub fn parse_html(cx: *JSContext,
None => {}
Some(src) => {
let img_url = make_url(src, Some(url2.clone()));
image_element.image = Some(copy img_url);
image_element.image = Some(img_url.clone());
// inform the image cache to load this, but don't store a handle.
// TODO (Issue #84): don't prefetch if we are within a <noscript>
// tag.

View file

@ -266,7 +266,7 @@ impl Page {
// Send new document and relevant styles to layout.
let reflow = ~Reflow {
document_root: do frame.document.with_base |doc| { doc.root },
url: copy self.url.get_ref().first(),
url: self.url.get_ref().first().clone(),
goal: goal,
window_size: self.window_size.get(),
script_chan: script_chan,
@ -498,7 +498,7 @@ impl ScriptTask {
js_info.js_compartment.define_functions(debug_fns);
js_info.js_context.evaluate_script(js_info.js_compartment.global_obj,
bytes,
copy url.path,
url.path.clone(),
1);
}
}

View file

@ -15,6 +15,7 @@ enum RangeRelation {
EntirelyAfter
}
#[deriving(Clone)]
pub struct Range {
priv off: uint,
priv len: uint

View file

@ -26,7 +26,7 @@ impl ProfilerChan {
}
}
#[deriving(Eq)]
#[deriving(Eq, Clone)]
pub enum ProfilerCategory {
CompositingCategory,
LayoutQueryCategory,

View file

@ -44,7 +44,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| copy *x).collect::<~[~str]>();
let mut path = path.iter().transform(|x| (*x).clone()).collect::<~[~str]>();
path.push(str_url);
let path = path.connect("/");
@ -118,6 +118,6 @@ mod make_url_tests {
pub type UrlMap<T> = @mut HashMap<Url, T>;
pub fn url_map<T: Copy>() -> UrlMap<T> {
pub fn url_map<T: Clone + 'static>() -> UrlMap<T> {
@mut HashMap::new()
}