diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2017-10-16 14:35:30 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2017-10-16 17:16:20 +0200 |
commit | aa15dc269f41503d81ad44cd7e85d69e6f4aeac7 (patch) | |
tree | 981d8d64c8de6ffd4c9e855553f34b6d09856d88 /components/script/task_source | |
parent | a5100e3c783f140c368da89e25e50581dce91bfd (diff) | |
download | servo-aa15dc269f41503d81ad44cd7e85d69e6f4aeac7.tar.gz servo-aa15dc269f41503d81ad44cd7e85d69e6f4aeac7.zip |
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.
Diffstat (limited to 'components/script/task_source')
6 files changed, 7 insertions, 7 deletions
diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs index 30dd3df8851..5eb20d2d274 100644 --- a/components/script/task_source/dom_manipulation.rs +++ b/components/script/task_source/dom_manipulation.rs @@ -36,7 +36,7 @@ impl TaskSource for DOMManipulationTaskSource { { let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task( ScriptThreadEventCategory::ScriptEvent, - box canceller.wrap_task(task), + Box::new(canceller.wrap_task(task)), )); self.0.send(msg).map_err(|_| ()) } diff --git a/components/script/task_source/file_reading.rs b/components/script/task_source/file_reading.rs index fc9af75794c..fe2ae2e4d17 100644 --- a/components/script/task_source/file_reading.rs +++ b/components/script/task_source/file_reading.rs @@ -29,7 +29,7 @@ impl TaskSource for FileReadingTaskSource { { self.0.send(CommonScriptMsg::Task( ScriptThreadEventCategory::FileRead, - box canceller.wrap_task(task), + Box::new(canceller.wrap_task(task)), )) } } diff --git a/components/script/task_source/history_traversal.rs b/components/script/task_source/history_traversal.rs index e5887264cf6..ffd657adada 100644 --- a/components/script/task_source/history_traversal.rs +++ b/components/script/task_source/history_traversal.rs @@ -15,6 +15,6 @@ impl ScriptChan for HistoryTraversalTaskSource { } fn clone(&self) -> Box<ScriptChan + Send> { - box HistoryTraversalTaskSource((&self.0).clone()) + Box::new(HistoryTraversalTaskSource((&self.0).clone())) } } diff --git a/components/script/task_source/networking.rs b/components/script/task_source/networking.rs index 8b167c5d905..41795227e5d 100644 --- a/components/script/task_source/networking.rs +++ b/components/script/task_source/networking.rs @@ -26,7 +26,7 @@ impl TaskSource for NetworkingTaskSource { { self.0.send(CommonScriptMsg::Task( ScriptThreadEventCategory::NetworkEvent, - box canceller.wrap_task(task), + Box::new(canceller.wrap_task(task)), )) } } @@ -40,7 +40,7 @@ impl NetworkingTaskSource { { self.0.send(CommonScriptMsg::Task( ScriptThreadEventCategory::NetworkEvent, - box task, + Box::new(task), )) } } diff --git a/components/script/task_source/performance_timeline.rs b/components/script/task_source/performance_timeline.rs index 1a3ffeb7fc7..0de171c4949 100644 --- a/components/script/task_source/performance_timeline.rs +++ b/components/script/task_source/performance_timeline.rs @@ -40,7 +40,7 @@ impl TaskSource for PerformanceTimelineTaskSource { { let msg = CommonScriptMsg::Task( ScriptThreadEventCategory::PerformanceTimelineTask, - box canceller.wrap_task(task) + Box::new(canceller.wrap_task(task)) ); self.0.send(msg).map_err(|_| ()) } diff --git a/components/script/task_source/user_interaction.rs b/components/script/task_source/user_interaction.rs index 9891f474529..c10e870ac7e 100644 --- a/components/script/task_source/user_interaction.rs +++ b/components/script/task_source/user_interaction.rs @@ -36,7 +36,7 @@ impl TaskSource for UserInteractionTaskSource { { let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task( ScriptThreadEventCategory::InputEvent, - box canceller.wrap_task(task), + Box::new(canceller.wrap_task(task)), )); self.0.send(msg).map_err(|_| ()) } |