servo/components/script
bors-servo a27c62717e
Auto merge of #20680 - Brody-Eastwood:master, r=emilio
Moved Canvas rendering to a single thread.

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

Implements the "Subsequent Steps" part of the [NCSU Canvas rendering project.](https://github.com/servo/servo/wiki/Canvas-rendering-project)

I moved most of the functionality from CanvasPaintThread to CanvasData, so CanvasPaintThread essentially just pulls the info out of the message and calls a method on a particular CanvasData element.

I ran into some awkwardness with the fact that one can only take a single mutable reference from a hashmap, though. DrawImageInOther is not really possible to do with only one reference at a time, so it awkwardly still lives in CanvasPaintThread, basically. I also would've preferred to take the reference at the top as soon as I get the CanvasId, since that looks cleaner than having them all start with "canvas_paint_thread.canvases.get_mut[&canvas_id].unwrap()" but that makes trying to take the second reference for DrawImageInOther fail to compile. I'm definitely open to suggestions on how to make that less gross.

The timed single-canvas drawing improved in performance from around ~2.2ms to around ~1.7ms. Slither.io runs better and doesn't crash, but I'm not having it crash on my copy from before these changes, so I don't know if that's new behavior or not.

---
<!-- 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 build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13879 and #10381.

<!-- Either: -->
- [X] There are tests for these changes (added in the initial steps)

<!-- 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/20680)
<!-- Reviewable:end -->
2018-04-24 01:14:20 -04:00
..
docs
dom Auto merge of #20680 - Brody-Eastwood:master, r=emilio 2018-04-24 01:14:20 -04:00
task_source
body.rs Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393 2018-03-28 21:28:30 +02:00
build.rs
Cargo.toml Implement gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE) 2018-04-17 20:44:35 -04:00
clipboard_provider.rs
CMakeLists.txt build(cmake): detect python binary for specified version 2018-03-13 09:25:06 -07:00
devtools.rs Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393 2018-03-28 21:28:30 +02:00
document_loader.rs Add a topLevelDomComplete metric. 2017-12-14 16:48:19 -06:00
fetch.rs Add FetchCanceller RAII handle 2017-11-21 16:45:03 -08:00
layout_image.rs
lib.rs Upgrade to rustc 1.27.0-nightly (056f589fb 2018-04-07) 2018-04-09 21:43:25 +02:00
mem.rs Pass new method in CollectServoSizes for accurate DOM heap use reporting 2018-03-27 20:35:39 -04:00
microtask.rs
network_listener.rs
script_runtime.rs Pass new method in CollectServoSizes for accurate DOM heap use reporting 2018-03-27 20:35:39 -04:00
script_thread.rs Remove insaccessible history states 2018-04-17 19:21:51 -05:00
serviceworker_manager.rs
serviceworkerjob.rs
stylesheet_loader.rs Split CssUrl from SpecifiedUrl for non-value URLs. 2018-03-08 23:34:34 +11:00
task.rs
test.rs
textinput.rs Correct default selectionStart and selectionEnd 2018-02-23 02:37:11 +05:30
timers.rs Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393 2018-03-28 21:28:30 +02:00
unpremultiplytable.rs
webdriver_handlers.rs Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393 2018-03-28 21:28:30 +02:00