mirror of
https://github.com/servo/servo
synced 2026-05-05 06:32:13 +02:00
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.
This commit is contained in:
@@ -33,14 +33,14 @@ impl ProgressEvent {
|
||||
}
|
||||
}
|
||||
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<ProgressEvent> {
|
||||
reflect_dom_object(box ProgressEvent::new_inherited(false, 0, 0),
|
||||
reflect_dom_object(Box::new(ProgressEvent::new_inherited(false, 0, 0)),
|
||||
global,
|
||||
ProgressEventBinding::Wrap)
|
||||
}
|
||||
pub fn new(global: &GlobalScope, type_: Atom,
|
||||
can_bubble: EventBubbles, cancelable: EventCancelable,
|
||||
length_computable: bool, loaded: u64, total: u64) -> DomRoot<ProgressEvent> {
|
||||
let ev = reflect_dom_object(box ProgressEvent::new_inherited(length_computable, loaded, total),
|
||||
let ev = reflect_dom_object(Box::new(ProgressEvent::new_inherited(length_computable, loaded, total)),
|
||||
global,
|
||||
ProgressEventBinding::Wrap);
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user