diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2020-01-23 07:53:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-23 07:53:58 -0500 |
commit | 2b77a992dba0547180b9bfd89a015556f8a51ba5 (patch) | |
tree | 89fd481d7d8fb18037c839ee29891a58e2a65898 /components/script/dom/gpu.rs | |
parent | 24674687acaaca3a796f8cc61bc98c6e7d0097fb (diff) | |
parent | dbed5f136438325bba20e24f0bff3aee4e86e763 (diff) | |
download | servo-2b77a992dba0547180b9bfd89a015556f8a51ba5.tar.gz servo-2b77a992dba0547180b9bfd89a015556f8a51ba5.zip |
Auto merge of #25580 - szeged:wgpu_worker, r=jdm
Support worker for WebGPU
To create resource ids for the WebGPU we need to access the `IdentityHub`.
In order to access the `IdentityHub` from a `Window` or a `Worker` as well, I've moved the `IdentityHub` to the `GlobalScope` from the `Navigator`.
<!-- 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 fix #25532
cc @kvark @jdm @zakorgy
Diffstat (limited to 'components/script/dom/gpu.rs')
-rw-r--r-- | components/script/dom/gpu.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/components/script/dom/gpu.rs b/components/script/dom/gpu.rs index 65f9cdeb0f8..0a6d6ca2dcf 100644 --- a/components/script/dom/gpu.rs +++ b/components/script/dom/gpu.rs @@ -5,7 +5,6 @@ use crate::compartments::InCompartment; use crate::dom::bindings::codegen::Bindings::GPUBinding::GPURequestAdapterOptions; use crate::dom::bindings::codegen::Bindings::GPUBinding::{self, GPUMethods, GPUPowerPreference}; -use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::error::Error; use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector}; @@ -14,7 +13,7 @@ use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; use crate::dom::gpuadapter::GPUAdapter; use crate::dom::promise::Promise; -use crate::task_source::TaskSource; +use crate::task_source::{TaskSource, TaskSourceName}; use dom_struct::dom_struct; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; @@ -69,11 +68,10 @@ pub fn response_async<T: AsyncWGPUListener + DomObject + 'static>( receiver: &T, ) -> IpcSender<WebGPUResponseResult> { let (action_sender, action_receiver) = ipc::channel().unwrap(); - let (task_source, canceller) = receiver + let task_source = receiver.global().dom_manipulation_task_source(); + let canceller = receiver .global() - .as_window() - .task_manager() - .dom_manipulation_task_source_with_canceller(); + .task_canceller(TaskSourceName::DOMManipulation); let mut trusted = Some(TrustedPromise::new(promise.clone())); let trusted_receiver = Trusted::new(receiver); ROUTER.add_route( @@ -121,7 +119,7 @@ impl GPUMethods for GPU { }, None => wgpu::instance::PowerPreference::Default, }; - let ids = global.as_window().Navigator().create_adapter_ids(); + let ids = global.wgpu_create_adapter_ids(); let script_to_constellation_chan = global.script_to_constellation_chan(); if script_to_constellation_chan |