[main-custom] Support D8 bomb-workers

Merge over our internal changes to the main-custom branch.

Sources:
- https://crrev.com/i/7397481
- https://crrev.com/i/7431936
- https://crrev.com/i/7448617

Change-Id: I4dcb2042afecd3f84aed717f70356bb24a692ef5
Reviewed-on: https://chromium-review.googlesource.com/c/external/github.com/WebKit/JetStream/+/6651528
Reviewed-by: Daniel Lehmann <dlehmann@chromium.org>
This commit is contained in:
Camillo Bruni 2025-06-17 14:21:45 +02:00
parent de8d4c1101
commit 58bea2e327
4 changed files with 21 additions and 6 deletions

View file

@ -482,7 +482,7 @@ class Driver {
}
async prefetchResourcesForBrowser() {
if (!isInBrowser)
if (!isInBrowser && !isD8)
return;
const promises = [];
@ -776,8 +776,13 @@ class Benchmark {
if (this.plan.preload) {
let str = "";
for (let [variableName, blobUrl] of this.preloads)
str += `const ${variableName} = "${blobUrl}";\n`;
if (isD8) {
for (let [variableName, filePath] of Object.entries(this.plan.preload))
str += `const ${variableName} = "${filePath}";\n`;
} else {
for (let [variableName, blobUrl] of this.preloads)
str += `const ${variableName} = "${blobUrl}";\n`;
}
addScript(str);
}
@ -902,6 +907,8 @@ class Benchmark {
}
prefetchResourcesForBrowser() {
if (isD8)
return this.prefetchResourcesForD8();
if (!isInBrowser)
return;
const promises = this.plan.files.map((file) => this.loadBlob("file", null, file).then((blobData) => {
@ -968,6 +975,10 @@ class Benchmark {
return !counter.failedPreloadResources && counter.loadedResources == counter.totalResources;
}
prefetchResourcesForD8() {
// For d8 we just keep the file name
}
async retryPrefetchResourcesForBrowser() {
if (!isInBrowser)
return;

View file

@ -599,8 +599,10 @@ class AsyncTaskWorker {
else {
var self = this;
setTimeout(function () {
if (self._currentTaskId == null)
if (self._currentTaskId == null) {
AsyncTaskWorker._workerSet.delete(self);
self._webWorker.terminate();
}
}, 1000);
}

View file

@ -41,7 +41,7 @@ function startWorker(file) {
}
function startCycle() {
if (!isInBrowser)
if (!isInBrowser && !isD8)
throw new Error("Only works in browser");
const tests = [

View file

@ -599,8 +599,10 @@ class AsyncTaskWorker {
else {
var self = this;
setTimeout(function () {
if (self._currentTaskId == null)
if (self._currentTaskId == null) {
AsyncTaskWorker._workerSet.delete(self);
self._webWorker.terminate();
}
}, 1000);
}