Auto merge of #21804 - AgustinCB:unify-task-source-canceller-api, r=gterzian

Unify the task source and task canceller API

To do so, I created a struct `TaskManagement(TaskSource,
TaskCanceller)` and made `*_task_source` return that instead of just
the task source.

Next, I refactored all places in which `task_canceller` by basically
removing them in favour of a previously called `*_task_source`.

I tried to make `task_canceller` a private method in `Window`, with the
hope of enforcing the use of `*_task_source`. However, it's used in
components/script/dom/globalscope.rs:575 in such a way that will make it
harder to avoid. I decided to leave it that way.

It'd be possible to unify `*_task_source` in such a way that we would
have only one method. However, I decided not to do it because one of the
`TaskSource` implementations is special:
`history_traversal_task_source`. Not wanting to over complicate things,
I decided to leave the structure this way.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21154 (github issue number if applicable).

- [x] These changes do not require tests because it's refactoring code that should already be tested.

<!-- 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/21804)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-11-16 09:54:40 -05:00 committed by GitHub
commit a2937d9488
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 389 additions and 252 deletions

View file

@ -101,6 +101,7 @@ pub enum ScriptThreadEventCategory {
DomEvent,
FileRead,
FormPlannedNavigation,
HistoryEvent,
ImageCacheMsg,
InputEvent,
NetworkEvent,