Commit 8f5133db authored by Ben Smith's avatar Ben Smith Committed by Commit Bot

Require AllowShared with FlexibleArrayBufferView

All methods that have a parameter with the FlexibleArrayBufferView
extended attribute support AllowShared. In other words, it is possible
to use them with an ArrayBufferView backed by an ArrayBuffer or a
SharedArrayBuffer. This CL makes this an explicit requirement in the IDL
file.

Currently only WebGL APIs use the FlexibleArrayBufferView extended
attribute.

Bug: chromium:905449
Change-Id: I52f23d4ee07c169a525243f00dd8a96a58ce7075
Reviewed-on: https://chromium-review.googlesource.com/c/1345125
Commit-Queue: Ben Smith <binji@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611175}
parent 6dd06076
...@@ -1433,6 +1433,8 @@ Summary: `[FlexibleArrayBufferView]` wraps a parameter that is known to be an Ar ...@@ -1433,6 +1433,8 @@ Summary: `[FlexibleArrayBufferView]` wraps a parameter that is known to be an Ar
The FlexibleArrayBufferView itself can then either refer to an actual ArrayBufferView or a temporary copy (for small payloads) that may even live on the stack. The idea is that copying the payload on the stack and referring to the temporary copy saves creating global handles (resulting in weak roots) in V8. Note that `[FlexibleArrayBufferView]` will actually result in a TypedFlexibleArrayBufferView wrapper for typed arrays. The FlexibleArrayBufferView itself can then either refer to an actual ArrayBufferView or a temporary copy (for small payloads) that may even live on the stack. The idea is that copying the payload on the stack and referring to the temporary copy saves creating global handles (resulting in weak roots) in V8. Note that `[FlexibleArrayBufferView]` will actually result in a TypedFlexibleArrayBufferView wrapper for typed arrays.
The FlexibleArrayBufferView extended attribute always requires the AllowShared extended attribute.
Usage: Applies to arguments of methods. See modules/webgl/WebGLRenderingContextBase.idl for an example. Usage: Applies to arguments of methods. See modules/webgl/WebGLRenderingContextBase.idl for an example.
### [AllowShared] _(p)_ ### [AllowShared] _(p)_
......
...@@ -656,6 +656,8 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name ...@@ -656,6 +656,8 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name
if 'FlexibleArrayBufferView' in extended_attributes: if 'FlexibleArrayBufferView' in extended_attributes:
if base_idl_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: if base_idl_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES:
raise ValueError('Unrecognized base type for extended attribute "FlexibleArrayBufferView": %s' % (idl_type.base_type)) raise ValueError('Unrecognized base type for extended attribute "FlexibleArrayBufferView": %s' % (idl_type.base_type))
if 'AllowShared' not in extended_attributes:
raise ValueError('"FlexibleArrayBufferView" extended attribute requires "AllowShared" on %s' % (idl_type.base_type))
base_idl_type = 'FlexibleArrayBufferView' base_idl_type = 'FlexibleArrayBufferView'
if 'AllowShared' in extended_attributes and not idl_type.is_array_buffer_view_or_typed_array: if 'AllowShared' in extended_attributes and not idl_type.is_array_buffer_view_or_typed_array:
......
...@@ -289,8 +289,8 @@ interface TestObject { ...@@ -289,8 +289,8 @@ interface TestObject {
void voidMethodArrayBufferArg(ArrayBuffer arrayBufferArg); void voidMethodArrayBufferArg(ArrayBuffer arrayBufferArg);
void voidMethodArrayBufferOrNullArg(ArrayBuffer? arrayBufferArg); void voidMethodArrayBufferOrNullArg(ArrayBuffer? arrayBufferArg);
void voidMethodArrayBufferViewArg(ArrayBufferView arrayBufferViewArg); void voidMethodArrayBufferViewArg(ArrayBufferView arrayBufferViewArg);
void voidMethodFlexibleArrayBufferViewArg([FlexibleArrayBufferView] ArrayBufferView arrayBufferViewArg); void voidMethodFlexibleArrayBufferViewArg([FlexibleArrayBufferView, AllowShared] ArrayBufferView arrayBufferViewArg);
void voidMethodFlexibleArrayBufferViewTypedArg([FlexibleArrayBufferView] Float32Array typedArrayBufferViewArg); void voidMethodFlexibleArrayBufferViewTypedArg([FlexibleArrayBufferView, AllowShared] Float32Array typedArrayBufferViewArg);
void voidMethodFloat32ArrayArg(Float32Array float32ArrayArg); void voidMethodFloat32ArrayArg(Float32Array float32ArrayArg);
void voidMethodInt32ArrayArg(Int32Array int32ArrayArg); void voidMethodInt32ArrayArg(Int32Array int32ArrayArg);
void voidMethodUint8ArrayArg(Uint8Array uint8ArrayArg); void voidMethodUint8ArrayArg(Uint8Array uint8ArrayArg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment