Skip to content

Clean up task sources and make all tasks cancellable#12404

Merged
bors-servo merged 4 commits intoservo:masterfrom
cbrewster:task_source_cleanup
Jul 13, 2016
Merged

Clean up task sources and make all tasks cancellable#12404
bors-servo merged 4 commits intoservo:masterfrom
cbrewster:task_source_cleanup

Conversation

@cbrewster
Copy link
Copy Markdown
Contributor

@cbrewster cbrewster commented Jul 12, 2016

This makes it so each task is a thin wrapper over a runnable and whenever a task is queued, it is automatically wrapped by the window's runnable_wrapper.


  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

Make tasks a wrapper over runnables
@highfive
Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @KiChjang: components/script/dom/htmltextareaelement.rs, components/script/dom/document.rs, components/script/task_source/user_interaction.rs, components/script/dom/storage.rs, components/script/network_listener.rs, components/script/dom/event.rs, components/script/dom/htmldetailselement.rs, components/script/dom/htmlformelement.rs, components/script/dom/htmlscriptelement.rs, components/script/dom/htmlmediaelement.rs, components/script/dom/htmlimageelement.rs, components/script/script_thread.rs, components/script/dom/htmlinputelement.rs, components/script/task_source/dom_manipulation.rs, components/script/task_source/mod.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 12, 2016
@highfive
Copy link
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@nox
Copy link
Copy Markdown
Contributor

nox commented Jul 12, 2016

@bors-servo r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit 6b0ce8e has been approved by nox

@highfive highfive assigned nox and unassigned asajeffrey Jul 12, 2016
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 12, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit 6b0ce8e with merge 0049ced...

bors-servo pushed a commit that referenced this pull request Jul 12, 2016
Clean up task sources and make all tasks cancellable

<!-- Please describe your changes on the following line: -->
This makes it so each task is a thin wrapper over a runnable and whenever a task is queued, it is automatically wrapped by the window's `runnable_wrapper`.

---
<!-- 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
- [ ] These changes do not require tests because _____

<!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12404)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jul 12, 2016
@jdm
Copy link
Copy Markdown
Member

jdm commented Jul 12, 2016

All the webstorage tests now time out, suggesting that something went wrong here :)

@cbrewster
Copy link
Copy Markdown
Contributor Author

Woops, CancellableRunnable needed to implement the new Runnable methods to call the proper method on their inner runnable.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jul 12, 2016
@cbrewster cbrewster force-pushed the task_source_cleanup branch from 8f565d8 to 714215c Compare July 12, 2016 19:58
@asajeffrey
Copy link
Copy Markdown
Contributor

May fix #11703?

@asajeffrey asajeffrey self-assigned this Jul 13, 2016
@asajeffrey
Copy link
Copy Markdown
Contributor

Mostly this looks good, and yay for one less intermittent! My only question is about the amount of boxing we're doing, can we replace Box<T> by T?


Reviewed 1 of 9 files at r1, 1 of 3 files at r2, 12 of 13 files at r3, 1 of 1 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


components/script/script_thread.rs, line 177 [r5] (raw file):

impl RunnableWrapper {
    pub fn wrap_runnable<T: Runnable + Send + 'static>(&self, runnable: Box<T>) -> Box<Runnable + Send> {

Why are we taking a Box<T> rather than a T as argument?


components/script/task_source/mod.rs, line 16 [r5] (raw file):

pub trait TaskSource {
    fn queue<T: Runnable + Send + 'static>(&self, msg: Box<T>, window: &Window) -> Result<(), ()>;

Why are we taking a Box<T> as an argument rather than a T?


Comments from Reviewable

@cbrewster
Copy link
Copy Markdown
Contributor Author

Review status: all files reviewed at latest revision, 2 unresolved discussions.


components/script/script_thread.rs, line 177 [r5] (raw file):

Previously, asajeffrey (Alan Jeffrey) wrote…

Why are we taking a Box<T> rather than a T as argument?

This doesn't end up boxing any more than usual, it just requires boxing the runnable before it reaches this point (as before this method boxed the runnable). I do think it is cleaner to have this method do the boxing rather than requiring the boxing to be done when the runnable is created.

components/script/task_source/mod.rs, line 16 [r5] (raw file):

Previously, asajeffrey (Alan Jeffrey) wrote…

Why are we taking a Box<T> as an argument rather than a T?

Same as above.

Comments from Reviewable

Implement all Runnable methods on CancellableRunnable to redirect to their inner runnable
@cbrewster cbrewster force-pushed the task_source_cleanup branch from 2b42b8f to 523cd73 Compare July 13, 2016 16:00
@asajeffrey
Copy link
Copy Markdown
Contributor

Review status: 5 of 16 files reviewed at latest revision, 2 unresolved discussions.


components/script/script_thread.rs, line 177 [r5] (raw file):

Previously, ConnorGBrewster (Connor Brewster) wrote…

This doesn't end up boxing any more than usual, it just requires boxing the runnable before it reaches this point (as before this method boxed the runnable). I do think it is cleaner to have this method do the boxing rather than requiring the boxing to be done when the runnable is created.

I meant why are we doing any boxing?

Comments from Reviewable

@KiChjang
Copy link
Copy Markdown
Contributor

@asajeffrey Because Runnable is a trait, and you cannot have a trait as an argument type.

@cbrewster cbrewster force-pushed the task_source_cleanup branch from 523cd73 to 862dc00 Compare July 13, 2016 17:10
@asajeffrey
Copy link
Copy Markdown
Contributor

Reviewed 10 of 11 files at r8, 1 of 1 files at r9.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/script/script_thread.rs, line 177 [r5] (raw file):

Previously, asajeffrey (Alan Jeffrey) wrote…

I meant why are we doing any boxing?

IRC conversation: http://logs.glob.uno/?c=mozilla%23servo&s=13+Jul+2016&e=13+Jul+2016#c479392

Comments from Reviewable

@asajeffrey
Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit 862dc00 has been approved by asajeffrey

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 13, 2016
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit 862dc00 with merge 3011d4b...

bors-servo pushed a commit that referenced this pull request Jul 13, 2016
Clean up task sources and make all tasks cancellable

<!-- Please describe your changes on the following line: -->
This makes it so each task is a thin wrapper over a runnable and whenever a task is queued, it is automatically wrapped by the window's `runnable_wrapper`.

---
<!-- 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
- [X] These changes fix  #11703 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12404)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows

@bors-servo bors-servo merged commit 862dc00 into servo:master Jul 13, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 13, 2016
@metajack metajack mentioned this pull request Jul 13, 2016
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent crash in /html/semantics/embedded-content/the-iframe-element/change_parentage.html (Option::unwrap on a None value)

7 participants