auto merge of #5422 : bdero/servo/bdero/box-syntax, r=jdm

Closes #5417
This commit is contained in:
bors-servo 2015-03-29 17:10:01 -06:00
commit 39556cc832
7 changed files with 19 additions and 17 deletions

View file

@ -294,7 +294,7 @@ impl LayoutTask {
};
// Register this thread as a memory reporter, via its own channel.
let reporter = Box::new(chan.clone());
let reporter = box chan.clone();
let reporter_name = format!("layout-reporter-{}", id.0);
mem_profiler_chan.send(mem::ProfilerMsg::RegisterReporter(reporter_name.clone(), reporter));

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(box_syntax)]
#![feature(collections)]
#![feature(core)]
#![cfg_attr(target_os="linux", feature(io))]

View file

@ -118,7 +118,7 @@ impl Profiler {
// Register the system memory reporter, which will run on the memory profiler's own thread.
// It never needs to be unregistered, because as long as the memory profiler is running the
// system memory reporter can make measurements.
let system_reporter = Box::new(SystemReporter);
let system_reporter = box SystemReporter;
mem_profiler_chan.send(ProfilerMsg::RegisterReporter("system".to_owned(), system_reporter));
mem_profiler_chan

View file

@ -359,10 +359,10 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
} else {
let chan = window.r().script_chan();
let handler = Trusted::new(window.r().get_cx(), self, chan.clone());
let dispatcher = Box::new(EventDispatcher {
let dispatcher = box EventDispatcher {
element: handler,
is_error: false,
});
};
chan.send(ScriptMsg::RunnableMsg(dispatcher)).unwrap();
}
}
@ -372,10 +372,10 @@ impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> {
let window = window.r();
let chan = window.script_chan();
let handler = Trusted::new(window.get_cx(), self, chan.clone());
let dispatcher = Box::new(EventDispatcher {
let dispatcher = box EventDispatcher {
element: handler,
is_error: true,
});
};
chan.send(ScriptMsg::RunnableMsg(dispatcher)).unwrap();
}

View file

@ -1101,7 +1101,7 @@ impl ScriptTask {
// https://html.spec.whatwg.org/multipage/#the-end step 4
let addr: Trusted<Document> = Trusted::new(self.get_cx(), document.r(), self.chan.clone());
let handler = Box::new(DocumentProgressHandler::new(addr.clone(), DocumentProgressTask::DOMContentLoaded));
let handler = box DocumentProgressHandler::new(addr.clone(), DocumentProgressTask::DOMContentLoaded);
self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();
// We have no concept of a document loader right now, so just dispatch the
@ -1109,7 +1109,7 @@ impl ScriptTask {
// the initial load.
// https://html.spec.whatwg.org/multipage/#the-end step 7
let handler = Box::new(DocumentProgressHandler::new(addr, DocumentProgressTask::Load));
let handler = box DocumentProgressHandler::new(addr, DocumentProgressTask::Load);
self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();
window.r().set_fragment_name(final_url.fragment.clone());

View file

@ -5,6 +5,7 @@
#![deny(unused_imports)]
#![deny(unused_variables)]
#![feature(box_syntax)]
#![feature(int_uint)]
#![feature(core, os, path, io, std_misc)]
// For FFI

View file

@ -453,7 +453,7 @@ extern fn gnw_decRef(base: *mut ANativeBase) {
impl GonkNativeWindow {
pub fn new(alloc_dev: *mut alloc_device, hwc_dev: *mut hwc_composer_device, width: i32, height: i32, usage: c_int) -> *mut GonkNativeWindow {
let win = Box::new(GonkNativeWindow {
let win = box GonkNativeWindow {
window: ANativeWindow {
common: ANativeBase {
magic: ANativeBase::magic('_', 'w', 'n', 'd'),
@ -496,7 +496,7 @@ impl GonkNativeWindow {
last_idx: -1,
bufs: unsafe { zeroed() },
fences: [-1, -1],
});
};
unsafe { transmute(win) }
}
@ -584,7 +584,7 @@ extern fn gnwb_decRef(base: *mut ANativeBase) {
impl GonkNativeWindowBuffer {
pub fn new(dev: *mut alloc_device, width: i32, height: i32, format: c_int, usage: c_int) -> *mut GonkNativeWindowBuffer {
let mut buf = Box::new(GonkNativeWindowBuffer {
let mut buf = box GonkNativeWindowBuffer {
buffer: ANativeWindowBuffer {
common: ANativeBase {
magic: ANativeBase::magic('_', 'b', 'f', 'r'),
@ -603,7 +603,7 @@ impl GonkNativeWindowBuffer {
reserved_proc: unsafe { zeroed() },
},
count: 1,
});
};
let ret = unsafe { ((*dev).alloc)(dev, width, height, format, usage, &mut buf.buffer.handle, &mut buf.buffer.stride) };
assert!(ret == 0, "Failed to allocate gralloc buffer!");
@ -822,11 +822,11 @@ impl WindowMethods for Window {
fn create_compositor_channel(window: &Option<Rc<Window>>)
-> (Box<CompositorProxy+Send>, Box<CompositorReceiver>) {
let (sender, receiver) = channel();
(Box::new(GonkCompositorProxy {
(box GonkCompositorProxy {
sender: sender,
event_sender: window.as_ref().unwrap().event_send.clone(),
}) as Box<CompositorProxy+Send>,
Box::new(receiver) as Box<CompositorReceiver>)
} as Box<CompositorProxy+Send>,
box receiver as Box<CompositorReceiver>)
}
fn set_cursor(&self, _: Cursor) {
@ -849,10 +849,10 @@ impl CompositorProxy for GonkCompositorProxy {
self.event_sender.send(WindowEvent::Idle).ok().unwrap();
}
fn clone_compositor_proxy(&self) -> Box<CompositorProxy+Send> {
Box::new(GonkCompositorProxy {
box GonkCompositorProxy {
sender: self.sender.clone(),
event_sender: self.event_sender.clone(),
}) as Box<CompositorProxy+Send>
} as Box<CompositorProxy+Send>
}
}