DawnNative: implement Instance::ProcessEvents

Since https://dawn-review.googlesource.com/c/dawn/+/120940, callbacks
will be deferred to be executed in next device.APITick() instead of
immediately.
However, if the device is already destroyed (last ref dropped),
user/wire_server has no chance to call device.APITick() anymore, leading
to the callbacks waiting in queue forever.

This is also possibly the cause of memory leaks in cluserfuzz tests.

This CL attempt to fix it by implementing Instance::ProcessEvents():
In this method, every created device will invoke APITick() even if it is
already lost/externally released.

bug: chromium:1422507
bug: dawn:752
Change-Id: Iec69ad3b547a7e88c6e1a2225b13ad060a501a4f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123420
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Le Hoang Quyen
2023-03-14 19:03:10 +00:00
committed by Dawn LUCI CQ
parent 5b3aaf6636
commit 69e1c4b638
11 changed files with 91 additions and 29 deletions

View File

@@ -187,6 +187,8 @@ class DAWN_NATIVE_EXPORT Instance {
uint64_t GetDeviceCountForTesting() const;
bool ProcessEvents();
// Returns the underlying WGPUInstance object.
WGPUInstance Get() const;