diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-07 14:26:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-07 14:26:44 -0700 |
commit | fdfde1c5ebfcbc1586a9f549886e3b54de1bcbde (patch) | |
tree | c090e641df11827eabc51e7c6060bea625fc8c30 /components/script/script_thread.rs | |
parent | 75cb4250b5b7f8a672428379f597a9e35a6a4f4f (diff) | |
parent | 54cf3afe3022b1aa7e01ac6c33383d1bb810bb20 (diff) | |
download | servo-fdfde1c5ebfcbc1586a9f549886e3b54de1bcbde.tar.gz servo-fdfde1c5ebfcbc1586a9f549886e3b54de1bcbde.zip |
Auto merge of #12292 - ConnorGBrewster:runnable_variant, r=KiChjang
Consolidate runnable variants on DOMManipulationTask into a single Runnable variant.
<!-- Please describe your changes on the following line: -->
Consolidates the runnable variants on `DOMManipulationTask` into a single `Runnable` variant.
Also combines `MainThreadRunnable` into the `Runnable` trait.
I plan on filing a few E-Easy issues after this lands to implement `name` on each of the structs that implement `Runnable`.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because refactoring
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12292)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 05689baac39..8a7fc82f52e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -200,11 +200,9 @@ impl<T: Runnable + Send> Runnable for CancellableRunnable<T> { pub trait Runnable { fn is_cancelled(&self) -> bool { false } - fn handler(self: Box<Self>); -} - -pub trait MainThreadRunnable { - fn handler(self: Box<Self>, script_thread: &ScriptThread); + fn name(&self) -> &'static str { "generic runnable" } + fn handler(self: Box<Self>) {} + fn main_thread_handler(self: Box<Self>, _script_thread: &ScriptThread) { self.handler(); } } enum MixedMessage { @@ -1223,7 +1221,7 @@ impl ScriptThread { // https://html.spec.whatwg.org/multipage/#the-end step 7 let handler = box DocumentProgressHandler::new(Trusted::new(doc)); - self.dom_manipulation_task_source.queue(DOMManipulationTask::DocumentProgress(handler)).unwrap(); + self.dom_manipulation_task_source.queue(DOMManipulationTask::Runnable(handler)).unwrap(); self.constellation_chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap(); } |