Index: Source/bindings/scripts/v8_types.py |
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py |
index f7ed4519cb63f9ea707605e095011277367fc986..396988fc523853551c62d37d122844fa2d87646d 100644 |
--- a/Source/bindings/scripts/v8_types.py |
+++ b/Source/bindings/scripts/v8_types.py |
@@ -184,8 +184,10 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ |
return 'String' |
return 'V8StringResource<%s>' % string_mode() |
- if idl_type.is_array_buffer_or_view and raw_type: |
- return idl_type.implemented_as + '*' |
+ if idl_type.base_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes: |
+ return 'FlexibleArrayBufferView' |
+ if idl_type.base_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes: |
+ return 'Flexible' + idl_type.base_type + 'View' |
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): |
@@ -343,6 +345,8 @@ def includes_for_cpp_class(class_name, relative_dir_posix): |
INCLUDES_FOR_TYPE = { |
'object': set(), |
+ 'ArrayBufferView': set(['bindings/core/v8/V8ArrayBufferView.h', |
+ 'core/dom/FlexibleArrayBufferView.h']), |
'Dictionary': set(['bindings/core/v8/Dictionary.h']), |
'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', |
'bindings/core/v8/V8EventListenerList.h']), |
@@ -376,6 +380,10 @@ def includes_for_type(idl_type, extended_attributes=None): |
base_idl_type = idl_type.base_type |
if base_idl_type in INCLUDES_FOR_TYPE: |
return INCLUDES_FOR_TYPE[base_idl_type] |
+ if idl_type.base_type in TYPED_ARRAY_TYPES: |
+ return INCLUDES_FOR_TYPE['ArrayBufferView'].union( |
+ set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], base_idl_type)]) |
+ ) |
if idl_type.is_basic_type: |
return set() |
if base_idl_type.endswith('ConstructorConstructor'): |
@@ -499,6 +507,7 @@ V8_VALUE_TO_CPP_VALUE = { |
# Interface types |
'Dictionary': 'Dictionary({v8_value}, {isolate}, exceptionState)', |
'EventTarget': 'toEventTarget({isolate}, {v8_value})', |
+ 'FlexibleArrayBufferView': 'toFlexibleArrayBufferView({isolate}, {v8_value}, {variable_name}, allocateFlexibleArrayBufferViewStorage({v8_value}))', |
'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), ScriptState::current({isolate}))', |
'Promise': 'ScriptPromise::cast(ScriptState::current({isolate}), {v8_value})', |
'SerializedScriptValue': 'SerializedScriptValueFactory::instance().create({isolate}, {v8_value}, 0, 0, exceptionState)', |
@@ -552,6 +561,11 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, variable_name |
idl_type = idl_type.preprocessed_type |
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 TYPED_ARRAY_TYPES.union(set(['ArrayBufferView'])): |
+ raise "Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type) |
+ base_idl_type = 'FlexibleArrayBufferView' |
+ |
if idl_type.is_integer_type: |
configuration = 'NormalConversion' |
if 'EnforceRange' in extended_attributes: |
@@ -648,6 +662,10 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl |
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 "Unrecognized base type for extended attribute 'FlexibleArrayBufferView': %s" % (idl_type.base_type) |
+ set_expression = cpp_value |
else: |
assign_expression = cpp_value |