mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01: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:
parent
a5100e3c78
commit
aa15dc269f
270 changed files with 580 additions and 514 deletions
|
@ -200,7 +200,7 @@ impl HTMLImageElement {
|
|||
let task_source = window.networking_task_source();
|
||||
let task_canceller = window.task_canceller();
|
||||
let generation = elem.generation.get();
|
||||
ROUTER.add_route(responder_receiver.to_opaque(), box move |message| {
|
||||
ROUTER.add_route(responder_receiver.to_opaque(), Box::new(move |message| {
|
||||
debug!("Got image {:?}", message);
|
||||
// Return the image via a message to the script thread, which marks
|
||||
// the element as dirty and triggers a reflow.
|
||||
|
@ -217,7 +217,7 @@ impl HTMLImageElement {
|
|||
}),
|
||||
&task_canceller,
|
||||
);
|
||||
});
|
||||
}));
|
||||
|
||||
image_cache.add_listener(id, ImageResponder::new(responder_sender, id));
|
||||
}
|
||||
|
@ -268,9 +268,9 @@ impl HTMLImageElement {
|
|||
task_source: window.networking_task_source(),
|
||||
canceller: Some(window.task_canceller()),
|
||||
};
|
||||
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
|
||||
ROUTER.add_route(action_receiver.to_opaque(), Box::new(move |message| {
|
||||
listener.notify_fetch(message.to().unwrap());
|
||||
});
|
||||
}));
|
||||
|
||||
let request = RequestInit {
|
||||
url: img_url.clone(),
|
||||
|
@ -640,7 +640,7 @@ impl HTMLImageElement {
|
|||
pub fn new(local_name: LocalName,
|
||||
prefix: Option<Prefix>,
|
||||
document: &Document) -> DomRoot<HTMLImageElement> {
|
||||
Node::reflect_node(box HTMLImageElement::new_inherited(local_name, prefix, document),
|
||||
Node::reflect_node(Box::new(HTMLImageElement::new_inherited(local_name, prefix, document)),
|
||||
document,
|
||||
HTMLImageElementBinding::Wrap)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue