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..c435a2030c3f2aaddff099f4c08cf27ef270086d 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): |
| @@ -376,6 +378,14 @@ 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 base_idl_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes: |
|
haraken
2015/07/30 14:54:57
Can we add this to INCLUDES_FOR_TYPE instead of ha
Michael Lippautz
2015/07/30 17:06:15
Done.
|
| + return set(['bindings/core/v8/V8ArrayBufferView.h', |
| + 'core/dom/FlexibleArrayBufferView.h']) |
| + if idl_type.base_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes: |
|
haraken
2015/07/30 14:54:57
Ditto.
Michael Lippautz
2015/07/30 17:06:15
For TYPED_ARRAY_TYPES we additionally need the
b
|
| + return set(['bindings/core/v8/V8ArrayBufferView.h', |
| + 'core/dom/TypedFlexibleArrayBufferView.h', |
| + '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 +509,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}, SMALL_ARRAY_BUFFER_VIEW_STORAGE({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 +563,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 14:54:57
Shouldn't this be:
'Flexible' + idl_type.base_t
Michael Lippautz
2015/07/30 17:06:15
Nope, both, FlexibleArrayBufferView and TypedFlexi
|
| + |
| if idl_type.is_integer_type: |
| configuration = 'NormalConversion' |
| if 'EnforceRange' in extended_attributes: |
| @@ -648,6 +664,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 idl_type.base_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in extended_attributes: |
| + set_expression = cpp_value |
| + elif idl_type.base_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in extended_attributes: |
|
haraken
2015/07/30 14:54:57
Slightly better:
elif 'FlexibleArrayBufferView' i
Michael Lippautz
2015/07/30 17:06:15
Done. Rewrote using regular if though as your sugg
|
| + set_expression = cpp_value |
| else: |
| assign_expression = cpp_value |