Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskSource-specific TaskCanceller #21119

Closed
gterzian opened this issue Jul 3, 2018 · 1 comment
Closed

TaskSource-specific TaskCanceller #21119

gterzian opened this issue Jul 3, 2018 · 1 comment

Comments

@gterzian
Copy link
Member

@gterzian gterzian commented Jul 3, 2018

In order to support stuff like #21114, we need the ability to cancel tasks in a more granular way, at the level of 'per tasksource'.

Currently 'cancelling' tasks is basically dependent on the ignore_further_async_events field on Window, which is the basis for the TaskCanceller returned via task_canceller, which is accessed via the queue method of the TaskSource trait(via the globalscope passed to that function).

One idea I can come up with is adding a new method to TaskSource, something like
fn choose_canceller<T>(&self, global: &GlobalScope) -> TaskCanceller, and then change queue to read something like the below:

let canceller = self.choose_canceller(&global);
self.queue_with_canceller(task, canceller);

Then each task source will need to implement choose_canceller, calling the appropriate method of GlobalScope, which would forward the call to the window, and the window would require a flag similar to ignore_further_async_events for each task source...

Any better ideas?

@gterzian gterzian closed this Jul 3, 2018
@gterzian gterzian reopened this Jul 3, 2018
@jdm
Copy link
Member

@jdm jdm commented Jul 4, 2018

That implementation makes sense to me!

@gterzian gterzian mentioned this issue Jul 5, 2018
0 of 5 tasks complete
bors-servo added a commit that referenced this issue 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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.