Rename SetErrorCallback to SetUncapturedErrorCallback

This is to better match the naming of the uncapturederror event
in WebGPU.

Bug: dawn:153
Change-Id: Ic2bc1f46bf3d1f0d14cbd5cb8ea6e54d1679f987
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10542
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/dawn.json b/dawn.json
index 53d1de5..7e03a5f 100644
--- a/dawn.json
+++ b/dawn.json
@@ -522,7 +522,7 @@
                 "name": "tick"
             },
             {
-                "name": "set error callback",
+                "name": "set uncaptured error callback",
                 "args": [
                     {"name": "callback", "type": "error callback"},
                     {"name": "userdata", "type": "void", "annotation": "*"}
diff --git a/dawn_wire.json b/dawn_wire.json
index a7fc103..509d823 100644
--- a/dawn_wire.json
+++ b/dawn_wire.json
@@ -66,7 +66,7 @@
             { "name": "request serial", "type": "uint32_t" },
             { "name": "status", "type": "uint32_t" }
         ],
-        "device error callback": [
+        "device uncaptured error callback": [
             { "name": "type", "type": "error type"},
             { "name": "message", "type": "char", "annotation": "const*", "length": "strlen" }
         ],
diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp
index 496ed7f..f777cac 100644
--- a/examples/SampleUtils.cpp
+++ b/examples/SampleUtils.cpp
@@ -161,7 +161,7 @@
     }
 
     dawnSetProcs(&procs);
-    procs.deviceSetErrorCallback(cDevice, PrintDeviceError, nullptr);
+    procs.deviceSetUncapturedErrorCallback(cDevice, PrintDeviceError, nullptr);
     return dawn::Device::Acquire(cDevice);
 }
 
diff --git a/generator/templates/mock_api.cpp b/generator/templates/mock_api.cpp
index 8a6dc58..e5d30b0 100644
--- a/generator/templates/mock_api.cpp
+++ b/generator/templates/mock_api.cpp
@@ -50,14 +50,14 @@
     {% endfor %}
 }
 
-void ProcTableAsClass::DeviceSetErrorCallback(DawnDevice self,
+void ProcTableAsClass::DeviceSetUncapturedErrorCallback(DawnDevice self,
                                               DawnErrorCallback callback,
                                               void* userdata) {
     auto object = reinterpret_cast<ProcTableAsClass::Object*>(self);
     object->deviceErrorCallback = callback;
     object->userdata1 = userdata;
 
-    OnDeviceSetErrorCallback(self, callback, userdata);
+    OnDeviceSetUncapturedErrorCallback(self, callback, userdata);
 }
 
 void ProcTableAsClass::DeviceCreateBufferMappedAsync(DawnDevice self,
diff --git a/generator/templates/mock_api.h b/generator/templates/mock_api.h
index 803e86e..a159a25 100644
--- a/generator/templates/mock_api.h
+++ b/generator/templates/mock_api.h
@@ -51,7 +51,7 @@
         {% endfor %}
 
         // Stores callback and userdata and calls the On* methods
-        void DeviceSetErrorCallback(DawnDevice self,
+        void DeviceSetUncapturedErrorCallback(DawnDevice self,
                                     DawnErrorCallback callback,
                                     void* userdata);
         void DeviceCreateBufferMappedAsync(DawnDevice self,
@@ -70,7 +70,7 @@
                                void* userdata);
 
         // Special cased mockable methods
-        virtual void OnDeviceSetErrorCallback(DawnDevice device,
+        virtual void OnDeviceSetUncapturedErrorCallback(DawnDevice device,
                                               DawnErrorCallback callback,
                                               void* userdata) = 0;
         virtual void OnDeviceCreateBufferMappedAsyncCallback(DawnDevice self,
@@ -133,7 +133,7 @@
             MOCK_METHOD1({{as_MethodSuffix(type.name, Name("release"))}}, void({{as_cType(type.name)}} self));
         {% endfor %}
 
-        MOCK_METHOD3(OnDeviceSetErrorCallback, void(DawnDevice device, DawnErrorCallback callback, void* userdata));
+        MOCK_METHOD3(OnDeviceSetUncapturedErrorCallback, void(DawnDevice device, DawnErrorCallback callback, void* userdata));
         MOCK_METHOD4(OnDeviceCreateBufferMappedAsyncCallback, void(DawnDevice device, const DawnBufferDescriptor* descriptor, DawnBufferCreateMappedCallback callback, void* userdata));
         MOCK_METHOD3(OnBufferMapReadAsyncCallback, void(DawnBuffer buffer, DawnBufferMapReadCallback callback, void* userdata));
         MOCK_METHOD3(OnBufferMapWriteAsyncCallback, void(DawnBuffer buffer, DawnBufferMapWriteCallback callback, void* userdata));
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index b557114..808f718 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -94,7 +94,7 @@
         }
     }
 
-    void DeviceBase::SetErrorCallback(dawn::ErrorCallback callback, void* userdata) {
+    void DeviceBase::SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata) {
         mErrorCallback = callback;
         mErrorUserdata = userdata;
     }
diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h
index 3d79d15..f19b40f 100644
--- a/src/dawn_native/Device.h
+++ b/src/dawn_native/Device.h
@@ -148,7 +148,7 @@
 
         void Tick();
 
-        void SetErrorCallback(dawn::ErrorCallback callback, void* userdata);
+        void SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata);
         void Reference();
         void Release();
 
diff --git a/src/dawn_wire/client/ApiProcs.cpp b/src/dawn_wire/client/ApiProcs.cpp
index 773a0d3..2ce5083 100644
--- a/src/dawn_wire/client/ApiProcs.cpp
+++ b/src/dawn_wire/client/ApiProcs.cpp
@@ -413,11 +413,11 @@
     void ClientDeviceRelease(DawnDevice) {
     }
 
-    void ClientDeviceSetErrorCallback(DawnDevice cSelf,
-                                      DawnErrorCallback callback,
-                                      void* userdata) {
+    void ClientDeviceSetUncapturedErrorCallback(DawnDevice cSelf,
+                                                DawnErrorCallback callback,
+                                                void* userdata) {
         Device* device = reinterpret_cast<Device*>(cSelf);
-        device->SetErrorCallback(callback, userdata);
+        device->SetUncapturedErrorCallback(callback, userdata);
     }
 
 }}  // namespace dawn_wire::client
diff --git a/src/dawn_wire/client/ClientDoers.cpp b/src/dawn_wire/client/ClientDoers.cpp
index 531d724..ded9544 100644
--- a/src/dawn_wire/client/ClientDoers.cpp
+++ b/src/dawn_wire/client/ClientDoers.cpp
@@ -18,7 +18,7 @@
 
 namespace dawn_wire { namespace client {
 
-    bool Client::DoDeviceErrorCallback(DawnErrorType errorType, const char* message) {
+    bool Client::DoDeviceUncapturedErrorCallback(DawnErrorType errorType, const char* message) {
         switch (errorType) {
             case DAWN_ERROR_TYPE_NO_ERROR:
             case DAWN_ERROR_TYPE_VALIDATION:
diff --git a/src/dawn_wire/client/Device.cpp b/src/dawn_wire/client/Device.cpp
index 2ada62f..fa5e876 100644
--- a/src/dawn_wire/client/Device.cpp
+++ b/src/dawn_wire/client/Device.cpp
@@ -31,7 +31,7 @@
         }
     }
 
-    void Device::SetErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata) {
+    void Device::SetUncapturedErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata) {
         mErrorCallback = errorCallback;
         mErrorUserdata = errorUserdata;
     }
diff --git a/src/dawn_wire/client/Device.h b/src/dawn_wire/client/Device.h
index eb725ff..3c7c377 100644
--- a/src/dawn_wire/client/Device.h
+++ b/src/dawn_wire/client/Device.h
@@ -29,7 +29,7 @@
 
         Client* GetClient();
         void HandleError(DawnErrorType errorType, const char* message);
-        void SetErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata);
+        void SetUncapturedErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata);
 
       private:
         Client* mClient = nullptr;
diff --git a/src/dawn_wire/server/Server.cpp b/src/dawn_wire/server/Server.cpp
index 695a762..ab56c4e 100644
--- a/src/dawn_wire/server/Server.cpp
+++ b/src/dawn_wire/server/Server.cpp
@@ -31,7 +31,7 @@
         auto* deviceData = DeviceObjects().Allocate(1);
         deviceData->handle = device;
 
-        mProcs.deviceSetErrorCallback(device, ForwardDeviceError, this);
+        mProcs.deviceSetUncapturedErrorCallback(device, ForwardUncapturedError, this);
     }
 
     Server::~Server() {
diff --git a/src/dawn_wire/server/Server.h b/src/dawn_wire/server/Server.h
index 76e0093..7f9ac15 100644
--- a/src/dawn_wire/server/Server.h
+++ b/src/dawn_wire/server/Server.h
@@ -54,7 +54,7 @@
         void* GetCmdSpace(size_t size);
 
         // Forwarding callbacks
-        static void ForwardDeviceError(DawnErrorType type, const char* message, void* userdata);
+        static void ForwardUncapturedError(DawnErrorType type, const char* message, void* userdata);
         static void ForwardBufferMapReadAsync(DawnBufferMapAsyncStatus status,
                                               const void* ptr,
                                               uint64_t dataLength,
@@ -66,7 +66,7 @@
         static void ForwardFenceCompletedValue(DawnFenceCompletionStatus status, void* userdata);
 
         // Error callbacks
-        void OnDeviceError(DawnErrorType type, const char* message);
+        void OnUncapturedError(DawnErrorType type, const char* message);
         void OnBufferMapReadAsyncCallback(DawnBufferMapAsyncStatus status,
                                           const void* ptr,
                                           uint64_t dataLength,
diff --git a/src/dawn_wire/server/ServerDevice.cpp b/src/dawn_wire/server/ServerDevice.cpp
index 06cf1f8..0ff3792 100644
--- a/src/dawn_wire/server/ServerDevice.cpp
+++ b/src/dawn_wire/server/ServerDevice.cpp
@@ -16,13 +16,13 @@
 
 namespace dawn_wire { namespace server {
 
-    void Server::ForwardDeviceError(DawnErrorType type, const char* message, void* userdata) {
+    void Server::ForwardUncapturedError(DawnErrorType type, const char* message, void* userdata) {
         auto server = static_cast<Server*>(userdata);
-        server->OnDeviceError(type, message);
+        server->OnUncapturedError(type, message);
     }
 
-    void Server::OnDeviceError(DawnErrorType type, const char* message) {
-        ReturnDeviceErrorCallbackCmd cmd;
+    void Server::OnUncapturedError(DawnErrorType type, const char* message) {
+        ReturnDeviceUncapturedErrorCallbackCmd cmd;
         cmd.type = type;
         cmd.message = message;
 
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index a062df5..a2dec47 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -458,7 +458,7 @@
     device = dawn::Device::Acquire(cDevice);
     queue = device.CreateQueue();
 
-    device.SetErrorCallback(OnDeviceError, this);
+    device.SetUncapturedErrorCallback(OnDeviceError, this);
 }
 
 void DawnTest::TearDown() {
diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp
index a1f0841..5b9a594 100644
--- a/src/tests/unittests/validation/ValidationTest.cpp
+++ b/src/tests/unittests/validation/ValidationTest.cpp
@@ -56,7 +56,7 @@
         deviceToTest = dawn::Device::Acquire(adapterToTest.CreateDevice(&descriptor));
     }
 
-    deviceToTest.SetErrorCallback(ValidationTest::OnDeviceError, this);
+    deviceToTest.SetUncapturedErrorCallback(ValidationTest::OnDeviceError, this);
     return deviceToTest;
 }
 
diff --git a/src/tests/unittests/wire/WireErrorCallbackTests.cpp b/src/tests/unittests/wire/WireErrorCallbackTests.cpp
index f9958ea..8bdcba6 100644
--- a/src/tests/unittests/wire/WireErrorCallbackTests.cpp
+++ b/src/tests/unittests/wire/WireErrorCallbackTests.cpp
@@ -59,7 +59,7 @@
 
 // Test the return wire for device error callbacks
 TEST_F(WireErrorCallbackTests, DeviceErrorCallback) {
-    dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, this);
+    dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, this);
 
     // Setting the error callback should stay on the client side and do nothing
     FlushClient();
diff --git a/src/tests/unittests/wire/WireFenceTests.cpp b/src/tests/unittests/wire/WireFenceTests.cpp
index c255826..7de32f2 100644
--- a/src/tests/unittests/wire/WireFenceTests.cpp
+++ b/src/tests/unittests/wire/WireFenceTests.cpp
@@ -120,7 +120,7 @@
 // Without any flushes, it is valid to signal a value greater than the current
 // signaled value
 TEST_F(WireFenceTests, QueueSignalSynchronousValidationSuccess) {
-    dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
+    dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
     EXPECT_CALL(*mockDeviceErrorCallback, Call(_, _, _)).Times(0);
 
     dawnQueueSignal(queue, fence, 2u);
@@ -131,7 +131,7 @@
 // Without any flushes, errors should be generated when signaling a value less
 // than or equal to the current signaled value
 TEST_F(WireFenceTests, QueueSignalSynchronousValidationError) {
-    dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
+    dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
 
     EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
     dawnQueueSignal(queue, fence, 0u);  // Error
@@ -217,7 +217,7 @@
 // Without any flushes, errors should be generated when waiting on a value greater
 // than the last signaled value
 TEST_F(WireFenceTests, OnCompletionSynchronousValidationError) {
-    dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, this + 1);
+    dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, this + 1);
 
     EXPECT_CALL(*mockFenceOnCompletionCallback, Call(DAWN_FENCE_COMPLETION_STATUS_ERROR, this + 0))
         .Times(1);
@@ -262,7 +262,7 @@
     EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2));
     FlushClient();
 
-    dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
+    dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
     EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
     dawnQueueSignal(queue2, fence, 2u);  // error
 }
@@ -274,7 +274,7 @@
     EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue2));
     FlushClient();
 
-    dawnDeviceSetErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
+    dawnDeviceSetUncapturedErrorCallback(device, ToMockDeviceErrorCallback, nullptr);
     EXPECT_CALL(*mockDeviceErrorCallback, Call(DAWN_ERROR_TYPE_VALIDATION, _, _)).Times(1);
     dawnQueueSignal(queue2, fence, 2u);  // error
 
diff --git a/src/tests/unittests/wire/WireTest.cpp b/src/tests/unittests/wire/WireTest.cpp
index f48696f..d64007f 100644
--- a/src/tests/unittests/wire/WireTest.cpp
+++ b/src/tests/unittests/wire/WireTest.cpp
@@ -41,7 +41,7 @@
     api.GetProcTableAndDevice(&mockProcs, &mockDevice);
 
     // This SetCallback call cannot be ignored because it is done as soon as we start the server
-    EXPECT_CALL(api, OnDeviceSetErrorCallback(_, _, _)).Times(Exactly(1));
+    EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(_, _, _)).Times(Exactly(1));
     SetupIgnoredCallExpectations();
 
     mS2cBuf = std::make_unique<utils::TerribleCommandBuffer>();