diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index fa450631f5..7bc8011c02 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -98,8 +98,10 @@ namespace dawn_native { mCurrentErrorScope->HandleError(type, message); } - void DeviceBase::HandleError(ErrorData* data) { - mCurrentErrorScope->HandleError(data); + void DeviceBase::ConsumeError(ErrorData* error) { + ASSERT(error != nullptr); + HandleError(error->GetType(), error->GetMessage().c_str()); + delete error; } void DeviceBase::SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata) { diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h index 1c3354f4c7..cf69282376 100644 --- a/src/dawn_native/Device.h +++ b/src/dawn_native/Device.h @@ -47,11 +47,10 @@ namespace dawn_native { virtual ~DeviceBase(); void HandleError(dawn::ErrorType type, const char* message); - void HandleError(ErrorData* error); bool ConsumedError(MaybeError maybeError) { if (DAWN_UNLIKELY(maybeError.IsError())) { - HandleError(maybeError.AcquireError()); + ConsumeError(maybeError.AcquireError()); return true; } return false; @@ -237,6 +236,8 @@ namespace dawn_native { void SetDefaultToggles(); + void ConsumeError(ErrorData* error); + AdapterBase* mAdapter = nullptr; Ref mRootErrorScope; diff --git a/src/dawn_native/ErrorScope.cpp b/src/dawn_native/ErrorScope.cpp index 812ab69433..1758ef71b3 100644 --- a/src/dawn_native/ErrorScope.cpp +++ b/src/dawn_native/ErrorScope.cpp @@ -15,7 +15,6 @@ #include "dawn_native/ErrorScope.h" #include "common/Assert.h" -#include "dawn_native/ErrorData.h" namespace dawn_native { @@ -50,11 +49,6 @@ namespace dawn_native { HandleErrorImpl(this, type, message); } - void ErrorScope::HandleError(ErrorData* error) { - ASSERT(error != nullptr); - HandleErrorImpl(this, error->GetType(), error->GetMessage().c_str()); - } - // static void ErrorScope::HandleErrorImpl(ErrorScope* scope, dawn::ErrorType type, const char* message) { ErrorScope* currentScope = scope; diff --git a/src/dawn_native/ErrorScope.h b/src/dawn_native/ErrorScope.h index 9bafcf9474..f3218cb41e 100644 --- a/src/dawn_native/ErrorScope.h +++ b/src/dawn_native/ErrorScope.h @@ -23,8 +23,6 @@ namespace dawn_native { - class ErrorData; - // Errors can be recorded into an ErrorScope by calling |HandleError|. // Because an error scope should not resolve until contained // commands are complete, calling the callback is deferred until it is destructed. @@ -47,7 +45,6 @@ namespace dawn_native { ErrorScope* GetParent(); void HandleError(dawn::ErrorType type, const char* message); - void HandleError(ErrorData* error); void Destroy();