Skip to content

Introduce "per task source" cancellation - #21126

Merged
bors-servo merged 1 commit into
servo:masterfrom
gterzian:tasksource_specific_cancelation
Jul 10, 2018
Merged

bors-servo merged 1 commit into
servo:masterfrom
gterzian:tasksource_specific_cancelation

Conversation

@gterzian

@gterzian gterzian commented Jul 5, 2018 •

Copy link
Copy Markdown
Member

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

This change is Reviewable

@highfive

highfive commented Jul 5, 2018

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/task_source/file_reading.rs, components/script/task_source/user_interaction.rs, components/script/dom/websocket.rs, components/script/fetch.rs, components/script/dom/globalscope.rs and 14 more
  • @KiChjang: components/script/task_source/file_reading.rs, components/script/task_source/user_interaction.rs, components/script/dom/websocket.rs, components/script/fetch.rs, components/script/dom/globalscope.rs and 14 more

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 5, 2018
@highfive

highfive commented Jul 5, 2018

Copy link
Copy Markdown

warning Warning warning

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

@gterzian
gterzian force-pushed the tasksource_specific_cancelation branch 2 times, most recently from edd4f18 to ebaf7cd Compare July 5, 2018 04:39
@gterzian gterzian changed the title [WIP] Introduce granular "per task source" cancellation [WIP] Introduce "per task source" cancellation Jul 5, 2018
@gterzian
gterzian force-pushed the tasksource_specific_cancelation branch 4 times, most recently from c277174 to e33b2ff Compare July 5, 2018 05:39
@gterzian gterzian changed the title [WIP] Introduce "per task source" cancellation Introduce "per task source" cancellation Jul 5, 2018
@gterzian

gterzian commented Jul 5, 2018

Copy link
Copy Markdown
Member Author

This one is ready for review, although I'm wondering about the right testing strategy for this one...

@gterzian
gterzian force-pushed the tasksource_specific_cancelation branch 4 times, most recently from bd8c344 to 48adf6a Compare July 5, 2018 08:09
@gterzian

gterzian commented Jul 5, 2018 •

Copy link
Copy Markdown
Member Author

For clarity this isn't suppose to 'change' anything about the behavior of the system, it only lays the groundwork for later changes, for example in #21114, which will require using a dedicated task source for EventSource and then only cancelling the networking tasks as part of document.abort, and letting the event source tasks run(allowing us to fail the connection after having cancelled the fetches).

So perhaps a good way to test is 'making sure everything still works as before', and then it is the follow up work that will include tests specifically asserting that certain tasks are cancelled while others still run?

@gterzian
gterzian force-pushed the tasksource_specific_cancelation branch 6 times, most recently from 9f20d1e to 8799aa0 Compare July 6, 2018 03:22
Comment thread components/script/task_source/mod.rs Outdated
// Retuns a vec of variants of TaskSourceName.
// Note: When adding a variant, update the vec.
pub fn all() -> Vec<TaskSourceName> {
vec![

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might as well make use of https://crates.io/crates/enum-iterator rather than keep track of this manually.

Comment thread components/script/task_source/mod.rs Outdated
where
T: TaskOnce + 'static;

fn choose_canceller(&self, global: &GlobalScope) -> TaskCanceller;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to use an associated constant instead, rather than having similar implementations for each task source.

context: context,
task_source: window.networking_task_source(),
canceller: Some(window.task_canceller()),
canceller: Some(window.task_canceller(TaskSourceName::Networking)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a followup, we should do something to avoid all of the duplication of calling foo_task_source and then getting a canceller where it's easy to end up with one for a different source. Possibly the foo_task_source APIs could return both a source and a canceller at the same time.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've filed #21154

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 10, 2018
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jul 10, 2018
@gterzian
gterzian force-pushed the tasksource_specific_cancelation branch from 044387f to 731fdee Compare July 10, 2018 04:51
@gterzian

Copy link
Copy Markdown
Member Author

@jdm Thanks for the pointers, comments have been addressed...

@gterzian
gterzian force-pushed the tasksource_specific_cancelation branch from 731fdee to 671627e Compare July 10, 2018 05:42
@jdm

jdm commented Jul 10, 2018

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 671627e has been approved by jdm

@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 10, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 671627e with merge 8988d67...

bors-servo pushed a commit that referenced this pull request Jul 10, 2018
Introduce "per task source" cancellation

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #21119 (github issue number if applicable).

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/21126)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: jdm
Pushing 8988d67 to master...

@bors-servo
bors-servo merged commit 671627e into servo:master Jul 10, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 10, 2018
@gterzian
gterzian deleted the tasksource_specific_cancelation branch July 10, 2018 14:56
bors-servo pushed a commit that referenced this pull request Jul 13, 2018
…tsource, r=jdm

Use remote-event task source in EventSource

<!-- Please describe your changes on the following line: -->
Follow up on #21126, this again 'changes nothing', but will be useful for #21111 in the context of #21114

Trying to break up work into smaller PR's ;)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #21112 (github issue number if applicable).

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/21170)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jul 13, 2018
…tsource, r=jdm

Use remote-event task source in EventSource

<!-- Please describe your changes on the following line: -->
Follow up on #21126, this again 'changes nothing', but will be useful for #21114 in the context of #21111.

Trying to break up work into smaller PR's ;)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #21112 (github issue number if applicable).

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/21170)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Jul 14, 2018
…tsource, r=jdm

Use remote-event task source in EventSource

<!-- Please describe your changes on the following line: -->
Follow up on #21126, this again 'changes nothing', but will be useful for #21114 in the context of #21111.

Trying to break up work into smaller PR's ;)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #21112 (github issue number if applicable).

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

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/21170)
<!-- Reviewable:end -->
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.

TaskSource-specific TaskCanceller

4 participants