DawnNative: Add dawn::native::InstanceProcessEvents()

Make this a standalone function instead of a dawn::native::Instance's
member method.

Some code base don't use dawn::native::Instance but instead use
wgpu::Instance. And InstanceProcessEvents() function actually returns
a bool unlike wgpu::Instance::ProcessEvents() which returns void.

Bug: dawn:752
Change-Id: Ia354a4ed5b5568ee23bcc70935c104059a9f6fc8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/125660
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
diff --git a/include/dawn/native/DawnNative.h b/include/dawn/native/DawnNative.h
index cf074cc..06e3f11 100644
--- a/include/dawn/native/DawnNative.h
+++ b/include/dawn/native/DawnNative.h
@@ -187,8 +187,6 @@
 
     uint64_t GetDeviceCountForTesting() const;
 
-    bool ProcessEvents();
-
     // Returns the underlying WGPUInstance object.
     WGPUInstance Get() const;
 
@@ -225,6 +223,8 @@
 
 DAWN_NATIVE_EXPORT bool DeviceTick(WGPUDevice device);
 
+DAWN_NATIVE_EXPORT bool InstanceProcessEvents(WGPUInstance instance);
+
 // ErrorInjector functions used for testing only. Defined in dawn_native/ErrorInjector.cpp
 DAWN_NATIVE_EXPORT void EnableErrorInjector();
 DAWN_NATIVE_EXPORT void DisableErrorInjector();
diff --git a/src/dawn/fuzzers/DawnWireServerFuzzer.cpp b/src/dawn/fuzzers/DawnWireServerFuzzer.cpp
index 2f85f17..3bf37621 100644
--- a/src/dawn/fuzzers/DawnWireServerFuzzer.cpp
+++ b/src/dawn/fuzzers/DawnWireServerFuzzer.cpp
@@ -136,7 +136,7 @@
     // Flush remaining callbacks to avoid memory leaks.
     // TODO(crbug.com/dawn/1712): DeviceNull's APITick() will always return true so cannot
     // do a polling loop here.
-    sInstance->ProcessEvents();
+    dawn::native::InstanceProcessEvents(sInstance->Get());
 
     // Note: Deleting the server will release all created objects.
     // Deleted devices will wait for idle on destruction.
diff --git a/src/dawn/native/DawnNative.cpp b/src/dawn/native/DawnNative.cpp
index 3e6ca72..21d8f41 100644
--- a/src/dawn/native/DawnNative.cpp
+++ b/src/dawn/native/DawnNative.cpp
@@ -251,10 +251,6 @@
     return mImpl->GetDeviceCountForTesting();
 }
 
-bool Instance::ProcessEvents() {
-    return mImpl->APIProcessEvents();
-}
-
 WGPUInstance Instance::Get() const {
     return ToAPI(mImpl);
 }
@@ -298,6 +294,10 @@
     return FromAPI(device)->APITick();
 }
 
+DAWN_NATIVE_EXPORT bool InstanceProcessEvents(WGPUInstance instance) {
+    return FromAPI(instance)->APIProcessEvents();
+}
+
 // ExternalImageDescriptor
 
 ExternalImageDescriptor::ExternalImageDescriptor(ExternalImageType type) : mType(type) {}