Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIntroduce "per task source" cancellation #21126
Conversation
highfive
commented
Jul 5, 2018
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jul 5, 2018
edd4f18
to
ebaf7cd
c277174
to
e33b2ff
|
This one is ready for review, although I'm wondering about the right testing strategy for this one... |
bd8c344
to
48adf6a
|
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 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? |
9f20d1e
to
8799aa0
| // Retuns a vec of variants of TaskSourceName. | ||
| // Note: When adding a variant, update the vec. | ||
| pub fn all() -> Vec<TaskSourceName> { | ||
| vec![ |
This comment has been minimized.
This comment has been minimized.
jdm
Jul 10, 2018
Member
We might as well make use of https://crates.io/crates/enum-iterator rather than keep track of this manually.
| @@ -22,10 +51,13 @@ pub trait TaskSource { | |||
| where | |||
| T: TaskOnce + 'static; | |||
|
|
|||
| fn choose_canceller(&self, global: &GlobalScope) -> TaskCanceller; | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jul 10, 2018
Member
It might make sense to use an associated constant instead, rather than having similar implementations for each task source.
| @@ -62,7 +63,7 @@ pub fn fetch_image_for_layout(url: ServoUrl, | |||
| let listener = NetworkListener { | |||
| context: context, | |||
| task_source: window.networking_task_source(), | |||
| canceller: Some(window.task_canceller()), | |||
| canceller: Some(window.task_canceller(TaskSourceName::Networking)), | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jul 10, 2018
Member
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.
This comment has been minimized.
This comment has been minimized.
044387f
to
731fdee
|
@jdm Thanks for the pointers, comments have been addressed... |
731fdee
to
671627e
|
@bors-servo r+ |
|
|
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 -->
|
|
…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 -->
…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 -->
…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 -->
gterzian commentedJul 5, 2018
•
edited by SimonSapin
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is