diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 3 | ||||
-rw-r--r-- | components/script/dom/extendablemessageevent.rs | 11 | ||||
-rw-r--r-- | components/script/dom/globalscope.rs | 32 | ||||
-rw-r--r-- | components/script/dom/gpuadapter.rs | 3 | ||||
-rw-r--r-- | components/script/dom/gpubuffer.rs | 7 | ||||
-rw-r--r-- | components/script/dom/gpucommandbuffer.rs | 38 | ||||
-rw-r--r-- | components/script/dom/gpucommandencoder.rs | 16 | ||||
-rw-r--r-- | components/script/dom/gpudevice.rs | 15 | ||||
-rw-r--r-- | components/script/dom/gpuqueue.rs | 73 | ||||
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 2 | ||||
-rw-r--r-- | components/script/dom/messageevent.rs | 11 | ||||
-rw-r--r-- | components/script/dom/mod.rs | 1 | ||||
-rw-r--r-- | components/script/dom/performanceobserver.rs | 22 | ||||
-rw-r--r-- | components/script/dom/webidls/GPUDevice.webidl | 7 | ||||
-rw-r--r-- | components/script/dom/webidls/GPUQueue.webidl | 18 | ||||
-rw-r--r-- | components/script/dom/webidls/PerformanceObserver.webidl | 3 |
17 files changed, 232 insertions, 32 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index a1cc4843021..c481cf8b2bb 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -154,7 +154,7 @@ use uuid::Uuid; use webgpu::{ WebGPU, WebGPUAdapter, WebGPUBindGroup, WebGPUBindGroupLayout, WebGPUBuffer, WebGPUCommandBuffer, WebGPUCommandEncoder, WebGPUComputePipeline, WebGPUDevice, - WebGPUPipelineLayout, WebGPUShaderModule, + WebGPUPipelineLayout, WebGPUQueue, WebGPUShaderModule, }; use webrender_api::{DocumentId, ImageKey}; use webvr_traits::{WebVRGamepadData, WebVRGamepadHand, WebVRGamepadState}; @@ -537,6 +537,7 @@ unsafe_no_jsmanaged_fields!(WebGPUBindGroup); unsafe_no_jsmanaged_fields!(WebGPUBindGroupLayout); unsafe_no_jsmanaged_fields!(WebGPUComputePipeline); unsafe_no_jsmanaged_fields!(WebGPUPipelineLayout); +unsafe_no_jsmanaged_fields!(WebGPUQueue); unsafe_no_jsmanaged_fields!(WebGPUShaderModule); unsafe_no_jsmanaged_fields!(WebGPUCommandBuffer); unsafe_no_jsmanaged_fields!(WebGPUCommandEncoder); diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs index ff9903fc1a6..ce9539d091f 100644 --- a/components/script/dom/extendablemessageevent.rs +++ b/components/script/dom/extendablemessageevent.rs @@ -159,10 +159,13 @@ impl ExtendableMessageEventMethods for ExtendableMessageEvent { .collect(); let frozen_ports = to_frozen_array(ports.as_slice(), cx); - // Cache the Js value. - let heap_val = Heap::default(); - heap_val.set(frozen_ports); - *self.frozen_ports.borrow_mut() = Some(heap_val); + // Safety: need to create the Heap value in its final memory location before setting it. + *self.frozen_ports.borrow_mut() = Some(Heap::default()); + self.frozen_ports + .borrow() + .as_ref() + .unwrap() + .set(frozen_ports); frozen_ports } diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index f96f1101bca..a773ac3c7c7 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -16,6 +16,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom}; use crate::dom::bindings::settings_stack::{entry_global, incumbent_global, AutoEntryScript}; use crate::dom::bindings::str::DOMString; use crate::dom::bindings::structuredclone; +use crate::dom::bindings::utils::to_frozen_array; use crate::dom::bindings::weakref::{DOMTracker, WeakRef}; use crate::dom::blob::Blob; use crate::dom::crypto::Crypto; @@ -31,6 +32,7 @@ use crate::dom::messageevent::MessageEvent; use crate::dom::messageport::MessagePort; use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope; use crate::dom::performance::Performance; +use crate::dom::performanceobserver::VALID_ENTRY_TYPES; use crate::dom::promise::Promise; use crate::dom::window::Window; use crate::dom::workerglobalscope::WorkerGlobalScope; @@ -63,7 +65,7 @@ use js::jsapi::JSObject; use js::jsapi::{CurrentGlobalOrNull, GetNonCCWObjectGlobal}; use js::jsapi::{HandleObject, Heap}; use js::jsapi::{JSAutoRealm, JSContext}; -use js::jsval::UndefinedValue; +use js::jsval::{JSVal, UndefinedValue}; use js::panic::maybe_resume_unwind; use js::rust::wrappers::EvaluateUtf8; use js::rust::{get_object_class, CompileOptionsWrapper, ParentRuntime, Runtime}; @@ -222,6 +224,10 @@ pub struct GlobalScope { #[ignore_malloc_size_of = "defined in wgpu"] gpu_id_hub: RefCell<Identities>, + + // https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute + #[ignore_malloc_size_of = "mozjs"] + frozen_supported_performance_entry_types: DomRefCell<Option<Heap<JSVal>>>, } /// A wrapper for glue-code between the ipc router and the event-loop. @@ -513,6 +519,7 @@ impl GlobalScope { is_headless, user_agent, gpu_id_hub: RefCell::new(Identities::new()), + frozen_supported_performance_entry_types: DomRefCell::new(Default::default()), } } @@ -2087,6 +2094,29 @@ impl GlobalScope { unreachable!(); } + // https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute + pub fn supported_performance_entry_types(&self, cx: SafeJSContext) -> JSVal { + if let Some(types) = &*self.frozen_supported_performance_entry_types.borrow() { + return types.get(); + } + + let types: Vec<DOMString> = VALID_ENTRY_TYPES + .iter() + .map(|t| DOMString::from(t.to_string())) + .collect(); + let frozen_types = to_frozen_array(types.as_slice(), cx); + + // Safety: need to create the Heap value in its final memory location before setting it. + *self.frozen_supported_performance_entry_types.borrow_mut() = Some(Heap::default()); + self.frozen_supported_performance_entry_types + .borrow() + .as_ref() + .unwrap() + .set(frozen_types); + + frozen_types + } + pub fn is_headless(&self) -> bool { self.is_headless } diff --git a/components/script/dom/gpuadapter.rs b/components/script/dom/gpuadapter.rs index f8ea0083153..abf8844522d 100644 --- a/components/script/dom/gpuadapter.rs +++ b/components/script/dom/gpuadapter.rs @@ -107,7 +107,7 @@ impl GPUAdapterMethods for GPUAdapter { impl AsyncWGPUListener for GPUAdapter { fn handle_response(&self, response: WebGPUResponse, promise: &Rc<Promise>) { match response { - WebGPUResponse::RequestDevice(device_id, _descriptor) => { + WebGPUResponse::RequestDevice(device_id, queue_id, _descriptor) => { let device = GPUDevice::new( &self.global(), self.channel.clone(), @@ -115,6 +115,7 @@ impl AsyncWGPUListener for GPUAdapter { Heap::default(), Heap::default(), device_id, + queue_id, ); promise.resolve_native(&device); }, diff --git a/components/script/dom/gpubuffer.rs b/components/script/dom/gpubuffer.rs index 8cc9bc52249..e0694e4d726 100644 --- a/components/script/dom/gpubuffer.rs +++ b/components/script/dom/gpubuffer.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::cell::DomRefCell; +use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::GPUBufferBinding::{ self, GPUBufferMethods, GPUBufferSize, }; @@ -91,6 +91,10 @@ impl GPUBuffer { pub fn usage(&self) -> u32 { self.usage } + + pub fn state(&self) -> Ref<GPUBufferState> { + self.state.borrow() + } } impl Drop for GPUBuffer { @@ -106,6 +110,7 @@ impl GPUBufferMethods for GPUBuffer { .0 .send(WebGPURequest::UnmapBuffer(self.buffer)) .unwrap(); + *self.state.borrow_mut() = GPUBufferState::Unmapped; } /// https://gpuweb.github.io/gpuweb/#dom-gpubuffer-destroy diff --git a/components/script/dom/gpucommandbuffer.rs b/components/script/dom/gpucommandbuffer.rs index 5cc4c926547..24cd781c092 100644 --- a/components/script/dom/gpucommandbuffer.rs +++ b/components/script/dom/gpucommandbuffer.rs @@ -2,17 +2,28 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use crate::dom::bindings::cell::DomRefCell; +use crate::dom::bindings::cell::{DomRefCell, Ref}; use crate::dom::bindings::codegen::Bindings::GPUCommandBufferBinding::{ self, GPUCommandBufferMethods, }; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::root::Dom; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::str::DOMString; use crate::dom::globalscope::GlobalScope; +use crate::dom::gpubuffer::GPUBuffer; use dom_struct::dom_struct; +use std::collections::HashSet; +use std::hash::{Hash, Hasher}; use webgpu::{WebGPU, WebGPUCommandBuffer}; +impl Eq for DomRoot<GPUBuffer> {} +impl Hash for DomRoot<GPUBuffer> { + fn hash<H: Hasher>(&self, state: &mut H) { + self.id().hash(state); + } +} + #[dom_struct] pub struct GPUCommandBuffer { reflector_: Reflector, @@ -20,15 +31,21 @@ pub struct GPUCommandBuffer { channel: WebGPU, label: DomRefCell<Option<DOMString>>, command_buffer: WebGPUCommandBuffer, + buffers: DomRefCell<HashSet<Dom<GPUBuffer>>>, } impl GPUCommandBuffer { - pub fn new_inherited(channel: WebGPU, command_buffer: WebGPUCommandBuffer) -> GPUCommandBuffer { + fn new_inherited( + channel: WebGPU, + command_buffer: WebGPUCommandBuffer, + buffers: HashSet<DomRoot<GPUBuffer>>, + ) -> GPUCommandBuffer { GPUCommandBuffer { channel, reflector_: Reflector::new(), label: DomRefCell::new(None), command_buffer, + buffers: DomRefCell::new(buffers.into_iter().map(|b| Dom::from_ref(&*b)).collect()), } } @@ -36,15 +53,30 @@ impl GPUCommandBuffer { global: &GlobalScope, channel: WebGPU, command_buffer: WebGPUCommandBuffer, + buffers: HashSet<DomRoot<GPUBuffer>>, ) -> DomRoot<GPUCommandBuffer> { reflect_dom_object( - Box::new(GPUCommandBuffer::new_inherited(channel, command_buffer)), + Box::new(GPUCommandBuffer::new_inherited( + channel, + command_buffer, + buffers, + )), global, GPUCommandBufferBinding::Wrap, ) } } +impl GPUCommandBuffer { + pub fn id(&self) -> WebGPUCommandBuffer { + self.command_buffer + } + + pub fn buffers(&self) -> Ref<HashSet<Dom<GPUBuffer>>> { + self.buffers.borrow() + } +} + impl GPUCommandBufferMethods for GPUCommandBuffer { /// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label fn GetLabel(&self) -> Option<DOMString> { diff --git a/components/script/dom/gpucommandencoder.rs b/components/script/dom/gpucommandencoder.rs index 5e86c0b8bfd..b0086ec0704 100644 --- a/components/script/dom/gpucommandencoder.rs +++ b/components/script/dom/gpucommandencoder.rs @@ -16,6 +16,7 @@ use crate::dom::gpucommandbuffer::GPUCommandBuffer; use crate::dom::gpucomputepassencoder::GPUComputePassEncoder; use dom_struct::dom_struct; use ipc_channel::ipc; +use std::collections::HashSet; use webgpu::{wgpu::command::RawPass, WebGPU, WebGPUCommandEncoder, WebGPURequest}; #[dom_struct] @@ -25,6 +26,7 @@ pub struct GPUCommandEncoder { channel: WebGPU, label: DomRefCell<Option<DOMString>>, encoder: WebGPUCommandEncoder, + buffers: DomRefCell<HashSet<DomRoot<GPUBuffer>>>, } impl GPUCommandEncoder { @@ -34,6 +36,7 @@ impl GPUCommandEncoder { reflector_: Reflector::new(), label: DomRefCell::new(None), encoder, + buffers: DomRefCell::new(HashSet::new()), } } @@ -82,6 +85,10 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder { destination_offset: u64, size: u64, ) { + self.buffers.borrow_mut().insert(DomRoot::from_ref(source)); + self.buffers + .borrow_mut() + .insert(DomRoot::from_ref(destination)); self.channel .0 .send(WebGPURequest::CopyBufferToBuffer( @@ -106,9 +113,14 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder { // TODO(zakorgy): We should use `_descriptor` here after it's not empty // and the underlying wgpu-core struct is serializable )) - .expect("Failed to send CopyBufferToBuffer"); + .expect("Failed to send Finish"); let buffer = receiver.recv().unwrap(); - GPUCommandBuffer::new(&self.global(), self.channel.clone(), buffer) + GPUCommandBuffer::new( + &self.global(), + self.channel.clone(), + buffer, + self.buffers.borrow_mut().drain().collect(), + ) } } diff --git a/components/script/dom/gpudevice.rs b/components/script/dom/gpudevice.rs index 514d6ad39d1..1d17961f87c 100644 --- a/components/script/dom/gpudevice.rs +++ b/components/script/dom/gpudevice.rs @@ -31,6 +31,7 @@ use crate::dom::gpubuffer::{GPUBuffer, GPUBufferState}; use crate::dom::gpucommandencoder::GPUCommandEncoder; use crate::dom::gpucomputepipeline::GPUComputePipeline; use crate::dom::gpupipelinelayout::GPUPipelineLayout; +use crate::dom::gpuqueue::GPUQueue; use crate::dom::gpushadermodule::GPUShaderModule; use crate::script_runtime::JSContext as SafeJSContext; use dom_struct::dom_struct; @@ -45,7 +46,7 @@ use webgpu::wgpu::binding_model::{ ShaderStage, }; use webgpu::wgpu::resource::{BufferDescriptor, BufferUsage}; -use webgpu::{WebGPU, WebGPUBuffer, WebGPUDevice, WebGPURequest}; +use webgpu::{WebGPU, WebGPUBuffer, WebGPUDevice, WebGPUQueue, WebGPURequest}; #[dom_struct] pub struct GPUDevice { @@ -59,6 +60,7 @@ pub struct GPUDevice { limits: Heap<*mut JSObject>, label: DomRefCell<Option<DOMString>>, device: WebGPUDevice, + default_queue: Dom<GPUQueue>, } impl GPUDevice { @@ -68,6 +70,7 @@ impl GPUDevice { extensions: Heap<*mut JSObject>, limits: Heap<*mut JSObject>, device: WebGPUDevice, + queue: &GPUQueue, ) -> GPUDevice { Self { eventtarget: EventTarget::new_inherited(), @@ -77,6 +80,7 @@ impl GPUDevice { limits, label: DomRefCell::new(None), device, + default_queue: Dom::from_ref(queue), } } @@ -88,10 +92,12 @@ impl GPUDevice { extensions: Heap<*mut JSObject>, limits: Heap<*mut JSObject>, device: WebGPUDevice, + queue: WebGPUQueue, ) -> DomRoot<GPUDevice> { + let queue = GPUQueue::new(global, channel.clone(), queue); reflect_dom_object( Box::new(GPUDevice::new_inherited( - channel, adapter, extensions, limits, device, + channel, adapter, extensions, limits, device, &queue, )), global, GPUDeviceBinding::Wrap, @@ -176,6 +182,11 @@ impl GPUDeviceMethods for GPUDevice { NonNull::new(self.extensions.get()).unwrap() } + /// https://gpuweb.github.io/gpuweb/#dom-gpudevice-defaultqueue + fn DefaultQueue(&self) -> DomRoot<GPUQueue> { + DomRoot::from_ref(&self.default_queue) + } + /// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label fn GetLabel(&self) -> Option<DOMString> { self.label.borrow().clone() diff --git a/components/script/dom/gpuqueue.rs b/components/script/dom/gpuqueue.rs new file mode 100644 index 00000000000..dfa97402253 --- /dev/null +++ b/components/script/dom/gpuqueue.rs @@ -0,0 +1,73 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use crate::dom::bindings::cell::DomRefCell; +use crate::dom::bindings::codegen::Bindings::GPUQueueBinding::{self, GPUQueueMethods}; +use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; +use crate::dom::bindings::root::DomRoot; +use crate::dom::bindings::str::DOMString; +use crate::dom::globalscope::GlobalScope; +use crate::dom::gpubuffer::GPUBufferState; +use crate::dom::gpucommandbuffer::GPUCommandBuffer; +use dom_struct::dom_struct; +use webgpu::{WebGPU, WebGPUQueue, WebGPURequest}; + +#[dom_struct] +pub struct GPUQueue { + reflector_: Reflector, + #[ignore_malloc_size_of = "defined in webgpu"] + channel: WebGPU, + label: DomRefCell<Option<DOMString>>, + queue: WebGPUQueue, +} + +impl GPUQueue { + fn new_inherited(channel: WebGPU, queue: WebGPUQueue) -> GPUQueue { + GPUQueue { + channel, + reflector_: Reflector::new(), + label: DomRefCell::new(None), + queue, + } + } + + pub fn new(global: &GlobalScope, channel: WebGPU, queue: WebGPUQueue) -> DomRoot<GPUQueue> { + reflect_dom_object( + Box::new(GPUQueue::new_inherited(channel, queue)), + global, + GPUQueueBinding::Wrap, + ) + } +} + +impl GPUQueueMethods for GPUQueue { + /// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label + fn GetLabel(&self) -> Option<DOMString> { + self.label.borrow().clone() + } + + /// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label + fn SetLabel(&self, value: Option<DOMString>) { + *self.label.borrow_mut() = value; + } + + /// https://gpuweb.github.io/gpuweb/#dom-gpuqueue-submit + fn Submit(&self, command_buffers: Vec<DomRoot<GPUCommandBuffer>>) { + let valid = command_buffers.iter().all(|cb| { + cb.buffers().iter().all(|b| match *b.state() { + GPUBufferState::Unmapped => true, + _ => false, + }) + }); + if !valid { + // TODO: Generate error to the ErrorScope + return; + } + let buffer_ids = command_buffers.iter().map(|cb| cb.id().0).collect(); + self.channel + .0 + .send(WebGPURequest::Submit(self.queue.0, buffer_ids)) + .unwrap(); + } +} diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index e8cd7737a2e..d9b0f11beef 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -2834,7 +2834,7 @@ impl ResourceTimingListener for HTMLMediaElementFetchListener { } fn resource_timing_global(&self) -> DomRoot<GlobalScope> { - (document_from_node(&*self.elem.root()).global()) + document_from_node(&*self.elem.root()).global() } } diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 74773bad36b..66a2cddc777 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -309,7 +309,7 @@ impl ResourceTimingListener for ClassicContext { } fn resource_timing_global(&self) -> DomRoot<GlobalScope> { - (document_from_node(&*self.elem.root()).global()) + document_from_node(&*self.elem.root()).global() } } diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index 62d7789e7e5..447c2f3ccd1 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -255,10 +255,13 @@ impl MessageEventMethods for MessageEvent { .collect(); let frozen_ports = to_frozen_array(ports.as_slice(), cx); - // Cache the Js value. - let heap_val = Heap::default(); - heap_val.set(frozen_ports); - *self.frozen_ports.borrow_mut() = Some(heap_val); + // Safety: need to create the Heap value in its final memory location before setting it. + *self.frozen_ports.borrow_mut() = Some(Heap::default()); + self.frozen_ports + .borrow() + .as_ref() + .unwrap() + .set(frozen_ports); frozen_ports } diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 2e2e8d9a35d..2401c5a55cb 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -328,6 +328,7 @@ pub mod gpucomputepassencoder; pub mod gpucomputepipeline; pub mod gpudevice; pub mod gpupipelinelayout; +pub mod gpuqueue; pub mod gpushadermodule; pub mod gpushaderstage; pub mod hashchangeevent; diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index e107c4a08d9..2b52c86e4f2 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -18,19 +18,21 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::performance::PerformanceEntryList; use crate::dom::performanceentry::PerformanceEntry; use crate::dom::performanceobserverentrylist::PerformanceObserverEntryList; +use crate::script_runtime::JSContext; use dom_struct::dom_struct; +use js::jsval::JSVal; use std::cell::Cell; use std::rc::Rc; -/// List of allowed performance entry types. -const VALID_ENTRY_TYPES: &'static [&'static str] = &[ +/// List of allowed performance entry types, in alphabetical order. +pub const VALID_ENTRY_TYPES: &'static [&'static str] = &[ + // "frame", //TODO Frame Timing API "mark", // User Timing API "measure", // User Timing API - "resource", // Resource Timing API "navigation", // Navigation Timing API - // "frame", //TODO Frame Timing API - // "server", XXX Server Timing API - "paint", // Paint Timing API + "paint", // Paint Timing API + "resource", // Resource Timing API + // "server", XXX Server Timing API ]; #[derive(Clone, Copy, JSTraceable, MallocSizeOf, PartialEq)] @@ -110,6 +112,14 @@ impl PerformanceObserver { pub fn set_entries(&self, entries: DOMPerformanceEntryList) { *self.entries.borrow_mut() = entries; } + + // https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute + #[allow(non_snake_case)] + pub fn SupportedEntryTypes(cx: JSContext, global: &GlobalScope) -> JSVal { + // While this is exposed through a method of PerformanceObserver, + // it is specified as associated with the global scope. + global.supported_performance_entry_types(cx) + } } impl PerformanceObserverMethods for PerformanceObserver { diff --git a/components/script/dom/webidls/GPUDevice.webidl b/components/script/dom/webidls/GPUDevice.webidl index 05fb449df8c..9c7195c9b18 100644 --- a/components/script/dom/webidls/GPUDevice.webidl +++ b/components/script/dom/webidls/GPUDevice.webidl @@ -5,13 +5,14 @@ // https://gpuweb.github.io/gpuweb/#gpudevice [Exposed=(Window, DedicatedWorker)/*, Serializable */, Pref="dom.webgpu.enabled"] interface GPUDevice : EventTarget { - readonly attribute GPUAdapter adapter; + /*[SameObject]*/ readonly attribute GPUAdapter adapter; readonly attribute object extensions; readonly attribute object limits; + [SameObject] readonly attribute GPUQueue defaultQueue; + GPUBuffer createBuffer(GPUBufferDescriptor descriptor); GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor); - // Promise<GPUMappedBuffer> createBufferMappedAsync(GPUBufferDescriptor descriptor); // GPUTexture createTexture(GPUTextureDescriptor descriptor); // GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); @@ -25,8 +26,6 @@ interface GPUDevice : EventTarget { GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {}); // GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor); - - // GPUQueue getQueue(); }; GPUDevice includes GPUObjectBase; diff --git a/components/script/dom/webidls/GPUQueue.webidl b/components/script/dom/webidls/GPUQueue.webidl new file mode 100644 index 00000000000..a1fdb9aa882 --- /dev/null +++ b/components/script/dom/webidls/GPUQueue.webidl @@ -0,0 +1,18 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://gpuweb.github.io/gpuweb/#gpuqueue +[Exposed=(Window, DedicatedWorker), Serializable, Pref="dom.webgpu.enabled"] +interface GPUQueue { + void submit(sequence<GPUCommandBuffer> commandBuffers); + + // GPUFence createFence(optional GPUFenceDescriptor descriptor = {}); + // void signal(GPUFence fence, unsigned long long signalValue); + + // void copyImageBitmapToTexture( + // GPUImageBitmapCopyView source, + // GPUTextureCopyView destination, + // GPUExtent3D copySize); +}; +GPUQueue includes GPUObjectBase; diff --git a/components/script/dom/webidls/PerformanceObserver.webidl b/components/script/dom/webidls/PerformanceObserver.webidl index dd3a66b299d..db511a7b4b7 100644 --- a/components/script/dom/webidls/PerformanceObserver.webidl +++ b/components/script/dom/webidls/PerformanceObserver.webidl @@ -21,5 +21,6 @@ interface PerformanceObserver { void observe(optional PerformanceObserverInit options = {}); void disconnect(); PerformanceEntryList takeRecords(); - // [SameObject] static readonly attribute FrozenArray<DOMString> supportedEntryTypes; + // codegen doesn't like SameObject+static and doesn't know FrozenArray + /*[SameObject]*/ static readonly attribute /*FrozenArray<DOMString>*/ any supportedEntryTypes; }; |