Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_types.py

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/v8_types.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_types.py b/third_party/WebKit/Source/bindings/scripts/v8_types.py
index 32c6b85aeb5f97f2b5eb683b508fa283fc2c833b..3e3cf395e2a1eb03879486e160d767274f4392d0 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_types.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_types.py
@@ -74,9 +74,6 @@
'Uint16Array',
'Uint32Array',
])
-ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES = TYPED_ARRAY_TYPES.union(frozenset([
- 'ArrayBufferView'
-]))
ARRAY_BUFFER_AND_VIEW_TYPES = TYPED_ARRAY_TYPES.union(frozenset([
'ArrayBuffer',
'ArrayBufferView',
@@ -87,9 +84,6 @@
IdlType.is_array_buffer_or_view = property(
lambda self: self.base_type in ARRAY_BUFFER_AND_VIEW_TYPES)
-
-IdlType.is_array_buffer_view_or_typed_array = property(
- lambda self: self.base_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES)
IdlType.is_typed_array = property(
lambda self: self.base_type in TYPED_ARRAY_TYPES)
@@ -208,9 +202,6 @@
return 'FlexibleArrayBufferView'
if base_idl_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes:
return 'Flexible' + base_idl_type + 'View'
- if base_idl_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES:
- if not used_in_cpp_sequence:
- return cpp_template_type('NotShared', idl_type.implemented_as)
if idl_type.is_interface_type:
implemented_as_class = idl_type.implemented_as
if raw_type or (used_as_rvalue_type and idl_type.is_garbage_collected) or not used_in_cpp_sequence:
@@ -352,7 +343,6 @@
INCLUDES_FOR_TYPE = {
'object': set(),
'ArrayBufferView': set(['bindings/core/v8/V8ArrayBufferView.h',
- 'core/dom/NotShared.h',
'core/dom/FlexibleArrayBufferView.h']),
'Dictionary': set(['bindings/core/v8/Dictionary.h']),
'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h',
@@ -469,8 +459,8 @@
includes_for_type.add(interface_info['include_path'])
if base_idl_type in INCLUDES_FOR_TYPE:
includes_for_type.update(INCLUDES_FOR_TYPE[base_idl_type])
- if idl_type.is_array_buffer_view_or_typed_array:
- return set(['core/dom/DOMTypedArray.h', 'core/dom/NotShared.h'])
+ if idl_type.is_typed_array:
+ return set(['core/dom/DOMTypedArray.h'])
return includes_for_type
@@ -529,7 +519,6 @@
return (idl_type.is_numeric_type or
idl_type.is_enum or
idl_type.is_dictionary or
- idl_type.is_array_buffer_view_or_typed_array or
idl_type.name in ('Boolean', 'ByteString', 'Date', 'Dictionary', 'USVString', 'SerializedScriptValue'))
IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_exception_state)
@@ -592,7 +581,7 @@
base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else idl_type.base_type
if 'FlexibleArrayBufferView' in extended_attributes:
- if base_idl_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES:
+ if base_idl_type not in TYPED_ARRAY_TYPES.union(set(['ArrayBufferView'])):
raise ValueError("Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type))
base_idl_type = 'FlexibleArrayBufferView'
@@ -610,13 +599,10 @@
if base_idl_type in V8_VALUE_TO_CPP_VALUE:
cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type]
- elif idl_type.name == 'ArrayBuffer':
+ elif idl_type.is_array_buffer_or_view:
cpp_expression_format = (
'{v8_value}->Is{idl_type}() ? '
'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) : 0')
- elif idl_type.is_array_buffer_view_or_typed_array:
- this_cpp_type = idl_type.cpp_type
- cpp_expression_format = ('ToNotShared<%s>({isolate}, {v8_value}, exceptionState)' % this_cpp_type)
elif idl_type.is_union_type:
nullable = 'UnionTypeConversionMode::kNullable' if idl_type.includes_nullable_type \
else 'UnionTypeConversionMode::kNotNullable'
@@ -691,11 +677,7 @@
# meaningful if 'check_expression' is not None.
return_expression = bailout_return_value
- if 'FlexibleArrayBufferView' in extended_attributes:
- if idl_type.base_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES:
- raise ValueError("Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type))
- set_expression = cpp_value
- elif idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state:
+ if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state:
# Types for which conversion can fail and that need error handling.
check_expression = 'exceptionState.HadException()'
@@ -717,6 +699,10 @@
return {
'error_message': 'no V8 -> C++ conversion for IDL type: %s' % idl_type.name
}
+ elif 'FlexibleArrayBufferView' in extended_attributes:
+ if idl_type.base_type not in TYPED_ARRAY_TYPES.union(set(['ArrayBufferView'])):
+ raise ValueError("Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type))
+ set_expression = cpp_value
else:
assign_expression = cpp_value
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/v8_dictionary.py ('k') | third_party/WebKit/Source/bindings/scripts/v8_union.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698