diff options
-rw-r--r-- | components/layout/layout_task.rs | 2 | ||||
-rw-r--r-- | components/profile/lib.rs | 1 | ||||
-rw-r--r-- | components/profile/mem.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 8 | ||||
-rw-r--r-- | components/script/script_task.rs | 4 | ||||
-rw-r--r-- | ports/gonk/src/main.rs | 1 | ||||
-rw-r--r-- | ports/gonk/src/window.rs | 18 |
7 files changed, 19 insertions, 17 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index 3a511033934..cc0bc094759 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -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)); diff --git a/components/profile/lib.rs b/components/profile/lib.rs index c8ffdc72d17..55a59065a4e 100644 --- a/components/profile/lib.rs +++ b/components/profile/lib.rs @@ -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))] diff --git a/components/profile/mem.rs b/components/profile/mem.rs index b6944b4ef59..8e2ef614ed6 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -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 diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 5d8f06c276a..637cb23ee2f 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -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(); } diff --git a/components/script/script_task.rs b/components/script/script_task.rs index e5463285200..c048b5c9813 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -1097,7 +1097,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 @@ -1105,7 +1105,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()); diff --git a/ports/gonk/src/main.rs b/ports/gonk/src/main.rs index 4a50c729018..df71eb58ff2 100644 --- a/ports/gonk/src/main.rs +++ b/ports/gonk/src/main.rs @@ -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 diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs index 982a11aa7fe..f16a7ed355b 100644 --- a/ports/gonk/src/window.rs +++ b/ports/gonk/src/window.rs @@ -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> } } |