diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-11-28 11:05:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-28 11:05:19 -0500 |
commit | b0012a62b2ac97bad2a12c048de830362e0ea4bc (patch) | |
tree | 0961191ed62b3bd819a58ef5f74e9173a0c9d550 /components/script/dom/navigator.rs | |
parent | 5f1681ad25921e7bb779a9223445167124e44e14 (diff) | |
parent | b26598d47094a24db3f8041c8e070229106e419d (diff) | |
download | servo-b0012a62b2ac97bad2a12c048de830362e0ea4bc.tar.gz servo-b0012a62b2ac97bad2a12c048de830362e0ea4bc.zip |
Auto merge of #24883 - szeged:id_management, r=jdm
Add WebGPU identity management
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes addresses a part of #24706
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
cc @jdm, @kvark, @zakorgy
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/navigator.rs')
-rw-r--r-- | components/script/dom/navigator.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index cb8fb2365cd..9121f7ef54d 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -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 { |