introduce task-queues, and throttling the performance-timeline task-source, in script and worker threads.

queue
This commit is contained in:
Gregory Terzian 2018-08-11 00:08:00 +02:00
parent da36740f0b
commit ca6306c430
10 changed files with 540 additions and 93 deletions

View file

@ -20684,6 +20684,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",
@ -32713,6 +32723,10 @@
"321132b7e7e21d542ce86e4322db04aba3e9d11e",
"support"
],
"mozilla/task_queue_throttling.any.js": [
"bbf464f384d55a44db6948d6cc7ab5f54509b800",
"testharness"
],
"mozilla/test.jpg": [
"110b3d6b666d35a117ca8c8ada32bf1002943044",
"support"

View 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");
});