Script: Convert routed_promise to GenericCallback (#41380)

This changes routed_promise to use the GenericCallback functionality.
This mostly effected WebGPU but also Clipboard and Memory Reporting.

We also added a GenericCallback::new_blocking() functionality which
produces a callback and a channel
which then can be blocked on. This was used a couple of times in the
code.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>

Testing: This should not change functionality.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger
2026-01-09 11:09:45 +01:00
committed by GitHub
parent 271c85910f
commit 46011ff50c
22 changed files with 116 additions and 88 deletions

View File

@@ -20,7 +20,7 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::promise::Promise;
use crate::dom::types::GPUDevice;
use crate::realms::InRealm;
use crate::routed_promise::{RoutedPromiseListener, route_promise};
use crate::routed_promise::{RoutedPromiseListener, callback_promise};
use crate::script_runtime::CanGc;
#[dom_struct]
@@ -95,7 +95,7 @@ impl GPUShaderModule {
promise.clone(),
can_gc,
);
let sender = route_promise(
let callback = callback_promise(
&promise,
&*shader_module,
device
@@ -111,7 +111,7 @@ impl GPUShaderModule {
program_id,
program: descriptor.code.0.clone(),
label: None,
sender,
callback,
})
.expect("Failed to create WebGPU ShaderModule");
shader_module