Commit 5c6ab6cf authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Deliver streaming client callback in background

If streaming compilation has been triggered on a worker, it can be
problematic to schedule a foreground task for the callback, since
workers might never return to the event queue. Hence, deliver the
callback in background. This is possible after this blink-side change:
https://crrev.com/c/1901592

R=ahaas@chromium.org
CC=​bbudge@chromium.org

Bug: chromium:1018029
Cq-Include-Trybots: luci.v8.try:v8_linux_blink_rel
Change-Id: I568c39cf97e94f6d1cec01090ece81e4521fa47c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1914199Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64946}
parent dad16fa5
......@@ -70,20 +70,9 @@ class WasmStreaming::WasmStreamingImpl {
}
void SetClient(std::shared_ptr<Client> client) {
// There are no other event notifications so just pass client to decoder.
// Wrap the client with a callback to trigger the callback in a new
// foreground task.
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate_);
v8::Platform* platform = i::V8::GetCurrentPlatform();
std::shared_ptr<TaskRunner> foreground_task_runner =
platform->GetForegroundTaskRunner(isolate_);
streaming_decoder_->SetModuleCompiledCallback(
[client, i_isolate, foreground_task_runner](
const std::shared_ptr<i::wasm::NativeModule>& native_module) {
foreground_task_runner->PostTask(
i::MakeCancelableTask(i_isolate, [client, native_module] {
client->OnModuleCompiled(Utils::Convert(native_module));
}));
[client](const std::shared_ptr<i::wasm::NativeModule>& native_module) {
client->OnModuleCompiled(Utils::Convert(native_module));
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment