mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
Promote LoseForTesting to ForceLoss device so that user agents can use.
Bug: chromium:1356738 Change-Id: I348837ad4224124d9adba1ecf69a05b2060760c9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100566 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Loko Kung <lokokung@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
@@ -479,7 +479,9 @@ void DeviceBase::APIDestroy() {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void DeviceBase::HandleError(InternalErrorType type, const char* message) {
|
||||
void DeviceBase::HandleError(InternalErrorType type,
|
||||
const char* message,
|
||||
WGPUDeviceLostReason lost_reason) {
|
||||
if (type == InternalErrorType::DeviceLost) {
|
||||
mState = State::Disconnected;
|
||||
|
||||
@@ -519,7 +521,7 @@ void DeviceBase::HandleError(InternalErrorType type, const char* message) {
|
||||
if (type == InternalErrorType::DeviceLost) {
|
||||
// The device was lost, call the application callback.
|
||||
if (mDeviceLostCallback != nullptr) {
|
||||
mDeviceLostCallback(WGPUDeviceLostReason_Undefined, message, mDeviceLostUserdata);
|
||||
mDeviceLostCallback(lost_reason, message, mDeviceLostUserdata);
|
||||
mDeviceLostCallback = nullptr;
|
||||
}
|
||||
|
||||
@@ -668,12 +670,11 @@ MaybeError DeviceBase::ValidateIsAlive() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
void DeviceBase::APILoseForTesting() {
|
||||
void DeviceBase::APIForceLoss(wgpu::DeviceLostReason reason, const char* message) {
|
||||
if (mState != State::Alive) {
|
||||
return;
|
||||
}
|
||||
|
||||
HandleError(InternalErrorType::Internal, "Device lost for testing");
|
||||
HandleError(InternalErrorType::Internal, message, ToAPI(reason));
|
||||
}
|
||||
|
||||
DeviceBase::State DeviceBase::GetState() const {
|
||||
|
||||
Reference in New Issue
Block a user