Chromium Code Reviews| 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..4d34b3d26d4c6038d827faea6efcbfb9fb7f6a33 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)]) |
|
haraken
2015/07/30 20:34:44
I'm wondering why we didn't need to include V8<arr
Michael Lippautz
2015/07/31 07:53:38
As TYPED_ARRAY_TYPES didn't get specialized handli
|
| + ) |
| 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 base_idl_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes: |
| + base_idl_type = 'FlexibleArrayBufferView' |
| + if idl_type.base_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes: |
| + base_idl_type = 'FlexibleArrayBufferView' |
|
haraken
2015/07/30 20:34:44
if 'FlexibleArrayBufferView' in extended_attribute
Michael Lippautz
2015/07/31 07:53:38
Done.
|
| + |
| 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 |