Bug 1975281 - refactor(webgpu): migrate ErrMsg::message from String to Cow<'static, str> r=webgpu-reviewers,nical

Differential Revision: https://phabricator.services.mozilla.com/D255877
This commit is contained in:
Erich Gubler authored and [email protected] committed 2025-07-09 01:26:42 +00:00
1 parent c94c954f72
commit 1574174eb1
2 files changed
+10 -3

No files matched your search

+2 -1
View File
@@ -6,6 +6,7 @@
//! of this module is [`ErrorBuffer`](crate::server::ErrorBuffer).
use std::{
borrow::Cow,
error::Error,
fmt::{self, Display, Formatter},
os::raw::c_char,
@@ -163,7 +164,7 @@ pub(crate) enum ErrorBufferType {
/// sources. Used for convenience in [`server`](crate::server) code.
#[derive(Clone, Debug)]
pub(crate) struct ErrMsg {
pub(crate) message: String,
pub(crate) message: Cow<'static, str>,
pub(crate) r#type: ErrorType,
}
+8 -2
View File
@@ -2153,7 +2153,7 @@ impl Global {
error_buf.init(
ErrMsg {
message: format!("Shader module creation failed: {message}"),
message: format!("Shader module creation failed: {message}").into(),
r#type: err.webgpu_error_type(),
},
device_id,
@@ -2259,7 +2259,13 @@ impl Global {
}
}
DeviceAction::Error { message, r#type } => {
error_buf.init(ErrMsg { message, r#type }, device_id);
error_buf.init(
ErrMsg {
message: message.into(),
r#type,
},
device_id,
);
}
DeviceAction::PushErrorScope(filter) => {
unsafe {