mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #21388 - gterzian:introduce_task_queues, r=jdm
Introduce task queues, and throttling performance timeline tasksource <!-- 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 #19997 (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/21388) <!-- Reviewable:end -->
This commit is contained in:
commit
1ee3deea27
10 changed files with 629 additions and 138 deletions
|
@ -20674,6 +20674,16 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/task_queue_throttling.any.js": [
|
||||
[
|
||||
"/_mozilla/mozilla/task_queue_throttling.any.html",
|
||||
{}
|
||||
],
|
||||
[
|
||||
"/_mozilla/mozilla/task_queue_throttling.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/textcontent.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/textcontent.html",
|
||||
|
@ -32667,6 +32677,10 @@
|
|||
"321132b7e7e21d542ce86e4322db04aba3e9d11e",
|
||||
"support"
|
||||
],
|
||||
"mozilla/task_queue_throttling.any.js": [
|
||||
"bbf464f384d55a44db6948d6cc7ab5f54509b800",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/test.jpg": [
|
||||
"110b3d6b666d35a117ca8c8ada32bf1002943044",
|
||||
"support"
|
||||
|
|
45
tests/wpt/mozilla/tests/mozilla/task_queue_throttling.any.js
Normal file
45
tests/wpt/mozilla/tests/mozilla/task_queue_throttling.any.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
// META: title=Throttling the performance timeline task queue.
|
||||
|
||||
async_test(function(t) {
|
||||
var counter = 0;
|
||||
|
||||
function perf_observer(list, observer) {
|
||||
// The timeline event should be throttled,
|
||||
// while the event-loop is busy,
|
||||
// and only handled after at least 6 other events,
|
||||
// across several iterations of the event-loop.
|
||||
assert_true(counter > 6)
|
||||
}
|
||||
var observer2 = new PerformanceObserver(t.step_func_done(perf_observer));
|
||||
observer2.observe({entryTypes: ["mark"]});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
counter++;
|
||||
};
|
||||
var blob = new Blob();
|
||||
reader.readAsText(blob);
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
counter++;
|
||||
// In a subsequent iteration of the event-loop,
|
||||
// start reading another 5 blobs
|
||||
for (var i = 0; i < 5; i++) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
counter++;
|
||||
};
|
||||
var blob = new Blob();
|
||||
reader.readAsText(blob);
|
||||
}
|
||||
};
|
||||
var blob = new Blob();
|
||||
reader.readAsText(blob);
|
||||
// We've started reading 5 blobs in this iteration of the event-loop.
|
||||
|
||||
// Do this in the current iteration of the event-loop.
|
||||
performance.mark("start");
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue