aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorbors-servo <servo-ops@mozilla.com>2020-06-01 20:53:20 -0400
committerGitHub <noreply@github.com>2020-06-01 20:53:20 -0400
commit2b24cfed10e01d91dd44a1015cc553a0fc09bbab (patch)
tree558306e4c353131ae6129b357b29cffc9e75c1f6 /components/script/dom/bindings
parentc30fcd94e69fde76bc0315eae5652a93dbd9f1ec (diff)
parentaf95d922315974dcfae5659b503a672b19026fdb (diff)
downloadservo-2b24cfed10e01d91dd44a1015cc553a0fc09bbab.tar.gz
servo-2b24cfed10e01d91dd44a1015cc553a0fc09bbab.zip
Auto merge of #26742 - kunalmohan:gpu-texture, r=kvark
Implement GPUTexture and GPUTextureView <!-- Please describe your changes on the following line: --> This also include changes to CodegenRust.py to allow enum values starting with digits. r?@kvark --- <!-- 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 - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- 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.--> <!-- 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/bindings')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py20
-rw-r--r--components/script/dom/bindings/trace.rs3
2 files changed, 15 insertions, 8 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index de97e2c9ea9..8c7eb3e7400 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -4328,7 +4328,7 @@ def getEnumValueName(value):
if re.match("[^\x20-\x7E]", value):
raise SyntaxError('Enum value "' + value + '" contains non-ASCII characters')
if re.match("^[0-9]", value):
- raise SyntaxError('Enum value "' + value + '" starts with a digit')
+ value = '_' + value
value = re.sub(r'[^0-9A-Za-z_]', '_', value)
if re.match("^_[A-Z]|__", value):
raise SyntaxError('Enum value "' + value + '" is reserved by the C++ spec')
@@ -4650,20 +4650,24 @@ class CGUnionConversionStruct(CGThing):
# "object" is not distinguishable from other types
assert not object or not (interfaceObject or arrayObject or callbackObject or mozMapObject)
templateBody = CGList([], "\n")
- if object:
- templateBody.append(object)
+ if arrayObject or callbackObject:
+ # An object can be both an sequence object and a callback or
+ # dictionary, but we shouldn't have both in the union's members
+ # because they are not distinguishable.
+ assert not (arrayObject and callbackObject)
+ templateBody.append(arrayObject if arrayObject else callbackObject)
if interfaceObject:
+ assert not object
templateBody.append(interfaceObject)
- if arrayObject:
- templateBody.append(arrayObject)
- if callbackObject:
- templateBody.append(callbackObject)
+ elif object:
+ templateBody.append(object)
if mozMapObject:
templateBody.append(mozMapObject)
+
conversions.append(CGIfWrapper("value.get().is_object()", templateBody))
if dictionaryObject:
- assert not hasObjectTypes
+ assert not object
conversions.append(dictionaryObject)
stringTypes = [t for t in memberTypes if t.isString() or t.isEnum()]
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 907abb890ee..faef319a61d 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -161,6 +161,7 @@ use webgpu::{
wgpu::command::RawPass, WebGPU, WebGPUAdapter, WebGPUBindGroup, WebGPUBindGroupLayout,
WebGPUBuffer, WebGPUCommandBuffer, WebGPUCommandEncoder, WebGPUComputePipeline, WebGPUDevice,
WebGPUPipelineLayout, WebGPUQueue, WebGPURenderPipeline, WebGPUSampler, WebGPUShaderModule,
+ WebGPUTexture, WebGPUTextureView,
};
use webrender_api::{DocumentId, ImageKey};
use webxr_api::SwapChainId as WebXRSwapChainId;
@@ -561,6 +562,8 @@ unsafe_no_jsmanaged_fields!(WebGPUPipelineLayout);
unsafe_no_jsmanaged_fields!(WebGPUQueue);
unsafe_no_jsmanaged_fields!(WebGPUShaderModule);
unsafe_no_jsmanaged_fields!(WebGPUSampler);
+unsafe_no_jsmanaged_fields!(WebGPUTexture);
+unsafe_no_jsmanaged_fields!(WebGPUTextureView);
unsafe_no_jsmanaged_fields!(WebGPUCommandBuffer);
unsafe_no_jsmanaged_fields!(WebGPUCommandEncoder);
unsafe_no_jsmanaged_fields!(WebGPUDevice);