diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-16 11:21:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-16 11:21:21 -0500 |
commit | a9022be0c3e30249845ca5947ac0c0a6743c7991 (patch) | |
tree | 00ce691d18ebd214fa85e811955db511d69ffec2 /components/script/dom/window.rs | |
parent | 5e3c4c21986b10ac7292d75245e57700f5075b1a (diff) | |
parent | aa15dc269f41503d81ad44cd7e85d69e6f4aeac7 (diff) | |
download | servo-a9022be0c3e30249845ca5947ac0c0a6743c7991.tar.gz servo-a9022be0c3e30249845ca5947ac0c0a6743c7991.zip |
Auto merge of #18900 - servo:box_syntax, r=emilio
Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master, and 102.68 with this PR. The latter is slightly better, but probably within noise level. So it looks like this PR does not affect DOM performance.
This is expected since `Box::new` is defined as:
```rust
impl<T> Box<T> {
#[inline(always)]
pub fn new(x: T) -> Box<T> {
box x
}
}
```
With inlining, it should compile to the same as box syntax.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18900)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index ed8e7cf9f49..1e4bf803427 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -344,7 +344,7 @@ impl Window { pub fn new_script_pair(&self) -> (Box<ScriptChan + Send>, Box<ScriptPort + Send>) { let (tx, rx) = channel(); - (box SendableMainThreadScriptChan(tx), box rx) + (Box::new(SendableMainThreadScriptChan(tx)), Box::new(rx)) } pub fn image_cache(&self) -> Arc<ImageCache> { @@ -1297,9 +1297,9 @@ impl Window { let (responder, responder_listener) = ipc::channel().unwrap(); let pipeline = self.upcast::<GlobalScope>().pipeline_id(); let image_cache_chan = self.image_cache_chan.clone(); - ROUTER.add_route(responder_listener.to_opaque(), box move |message| { + ROUTER.add_route(responder_listener.to_opaque(), Box::new(move |message| { let _ = image_cache_chan.send((pipeline, message.to().unwrap())); - }); + })); self.image_cache.add_listener(id, ImageResponder::new(responder, id)); nodes.push(Dom::from_ref(&*node)); } @@ -1804,7 +1804,7 @@ impl Window { pipelineid, script_chan: Arc::new(Mutex::new(control_chan)), }; - let win = box Self { + let win = Box::new(Self { globalscope: GlobalScope::new_inherited( pipelineid, devtools_chan, @@ -1868,7 +1868,7 @@ impl Window { unminified_js_dir: Default::default(), test_worklet: Default::default(), paint_worklet: Default::default(), - }; + }); unsafe { WindowBinding::Wrap(runtime.cx(), win) @@ -1982,7 +1982,7 @@ impl Window { // TODO(#12718): Use the "posted message task source". let _ = self.script_chan.send(CommonScriptMsg::Task( ScriptThreadEventCategory::DomEvent, - box self.task_canceller().wrap_task(task), + Box::new(self.task_canceller().wrap_task(task)), )); } } |