From 9ff1536facc7ea62a152ba821290000dd3d6bb89 Mon Sep 17 00:00:00 2001 From: Lokbondo Kung Date: Thu, 22 Aug 2024 20:56:54 +0000 Subject: [PATCH] [dawn][emscripten] Fix promise handling and pass callback. - Before the code was effectively doing: ``` let ret = resolve(futureId); promise.finally(ret); ``` With the lambda wrapping the resolve call, the callback only happens after the resolution of the parent promise. Bug: 358445329 Change-Id: I9aca5e3476b08660780a32cac6d2cb8d70360ed1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/203420 Reviewed-by: Austin Eng Commit-Queue: Austin Eng Commit-Queue: Loko Kung Auto-Submit: Loko Kung Reviewed-by: Shrek Shao --- third_party/emdawnwebgpu/library_webgpu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/emdawnwebgpu/library_webgpu.js b/third_party/emdawnwebgpu/library_webgpu.js index 0041c106c03..0d05bbb7ddf 100644 --- a/third_party/emdawnwebgpu/library_webgpu.js +++ b/third_party/emdawnwebgpu/library_webgpu.js @@ -95,7 +95,7 @@ var LibraryWebGPU = { #if ASYNCIFY var futureId = futureIdH * 0x100000000 + futureIdL; WebGPU._futures[futureId] = - new Promise((resolve) => promise.finally(resolve(futureId))); + new Promise((resolve) => promise.finally(() => resolve(futureId))); #endif }, _waitAnyPromisesList: [],