mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add WebGPU identity management
Issue: https://github.com/servo/servo/issues/24706#issuecomment-557891841
This commit is contained in:
parent
ea32495504
commit
b26598d470
6 changed files with 72 additions and 13 deletions
|
@ -12,6 +12,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::bluetooth::Bluetooth;
|
||||
use crate::dom::gamepadlist::GamepadList;
|
||||
use crate::dom::gpu::GPU;
|
||||
use crate::dom::identityhub::Identities;
|
||||
use crate::dom::mediadevices::MediaDevices;
|
||||
use crate::dom::mediasession::MediaSession;
|
||||
use crate::dom::mimetypearray::MimeTypeArray;
|
||||
|
@ -23,7 +24,9 @@ use crate::dom::serviceworkercontainer::ServiceWorkerContainer;
|
|||
use crate::dom::window::Window;
|
||||
use crate::dom::xr::XR;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use webgpu::wgpu::AdapterId;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Navigator {
|
||||
|
@ -38,6 +41,8 @@ pub struct Navigator {
|
|||
permissions: MutNullableDom<Permissions>,
|
||||
mediasession: MutNullableDom<MediaSession>,
|
||||
gpu: MutNullableDom<GPU>,
|
||||
#[ignore_malloc_size_of = "Defined in wgpu"]
|
||||
gpu_id_hub: RefCell<Identities>,
|
||||
}
|
||||
|
||||
impl Navigator {
|
||||
|
@ -54,6 +59,7 @@ impl Navigator {
|
|||
permissions: Default::default(),
|
||||
mediasession: Default::default(),
|
||||
gpu: Default::default(),
|
||||
gpu_id_hub: RefCell::new(Identities::new()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +72,12 @@ impl Navigator {
|
|||
}
|
||||
}
|
||||
|
||||
impl Navigator {
|
||||
pub fn create_adapter_id(&self) -> AdapterId {
|
||||
self.gpu_id_hub.borrow_mut().create_adapter_id()
|
||||
}
|
||||
}
|
||||
|
||||
impl NavigatorMethods for Navigator {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-navigator-product
|
||||
fn Product(&self) -> DOMString {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue