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>
This commit is contained in:
parent
cb0cb658d4
commit
45ea7e66bf
|
@ -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": "*"}
|
||||
|
|
|
@ -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" }
|
||||
],
|
||||
|
|
|
@ -161,7 +161,7 @@ dawn::Device CreateCppDawnDevice() {
|
|||
}
|
||||
|
||||
dawnSetProcs(&procs);
|
||||
procs.deviceSetErrorCallback(cDevice, PrintDeviceError, nullptr);
|
||||
procs.deviceSetUncapturedErrorCallback(cDevice, PrintDeviceError, nullptr);
|
||||
return dawn::Device::Acquire(cDevice);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,14 +50,14 @@ void ProcTableAsClass::GetProcTableAndDevice(DawnProcTable* table, DawnDevice* d
|
|||
{% 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,
|
||||
|
|
|
@ -51,7 +51,7 @@ class ProcTableAsClass {
|
|||
{% 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 @@ class ProcTableAsClass {
|
|||
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 @@ class MockProcTable : public ProcTableAsClass {
|
|||
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));
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
void DeviceBase::SetErrorCallback(dawn::ErrorCallback callback, void* userdata) {
|
||||
void DeviceBase::SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata) {
|
||||
mErrorCallback = callback;
|
||||
mErrorUserdata = userdata;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace dawn_native {
|
|||
|
||||
void Tick();
|
||||
|
||||
void SetErrorCallback(dawn::ErrorCallback callback, void* userdata);
|
||||
void SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata);
|
||||
void Reference();
|
||||
void Release();
|
||||
|
||||
|
|
|
@ -413,11 +413,11 @@ namespace dawn_wire { namespace client {
|
|||
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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_wire { namespace client {
|
|||
}
|
||||
}
|
||||
|
||||
void Device::SetErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata) {
|
||||
void Device::SetUncapturedErrorCallback(DawnErrorCallback errorCallback, void* errorUserdata) {
|
||||
mErrorCallback = errorCallback;
|
||||
mErrorUserdata = errorUserdata;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace dawn_wire { namespace client {
|
|||
|
||||
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;
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_wire { namespace server {
|
|||
auto* deviceData = DeviceObjects().Allocate(1);
|
||||
deviceData->handle = device;
|
||||
|
||||
mProcs.deviceSetErrorCallback(device, ForwardDeviceError, this);
|
||||
mProcs.deviceSetUncapturedErrorCallback(device, ForwardUncapturedError, this);
|
||||
}
|
||||
|
||||
Server::~Server() {
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace dawn_wire { namespace server {
|
|||
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 @@ namespace dawn_wire { namespace server {
|
|||
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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ void DawnTest::SetUp() {
|
|||
device = dawn::Device::Acquire(cDevice);
|
||||
queue = device.CreateQueue();
|
||||
|
||||
device.SetErrorCallback(OnDeviceError, this);
|
||||
device.SetUncapturedErrorCallback(OnDeviceError, this);
|
||||
}
|
||||
|
||||
void DawnTest::TearDown() {
|
||||
|
|
|
@ -56,7 +56,7 @@ dawn::Device ValidationTest::CreateDeviceFromAdapter(
|
|||
deviceToTest = dawn::Device::Acquire(adapterToTest.CreateDevice(&descriptor));
|
||||
}
|
||||
|
||||
deviceToTest.SetErrorCallback(ValidationTest::OnDeviceError, this);
|
||||
deviceToTest.SetUncapturedErrorCallback(ValidationTest::OnDeviceError, this);
|
||||
return deviceToTest;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class WireErrorCallbackTests : public WireTest {
|
|||
|
||||
// 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();
|
||||
|
|
|
@ -120,7 +120,7 @@ TEST_F(WireFenceTests, QueueSignalSuccess) {
|
|||
// 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 @@ TEST_F(WireFenceTests, QueueSignalSynchronousValidationSuccess) {
|
|||
// 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 @@ TEST_F(WireFenceTests, OnCompletionSynchronousValidationSuccess) {
|
|||
// 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 @@ TEST_F(WireFenceTests, SignalWrongQueue) {
|
|||
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 @@ TEST_F(WireFenceTests, SignalWrongQueueDoesNotUpdateValue) {
|
|||
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
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void WireTest::SetUp() {
|
|||
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>();
|
||||
|
|
Loading…
Reference in New Issue