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 57e83dca94d9414c29b7aa7f7fa90c82d8b718f0..0b29c012472e7bc25535d3eb7d7e996d0ad5ecce 100644 |
| --- a/Source/bindings/scripts/v8_types.py |
| +++ b/Source/bindings/scripts/v8_types.py |
| @@ -150,6 +150,9 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ |
| extended_attributes = extended_attributes or {} |
| idl_type = idl_type.preprocessed_type |
| + if idl_type.is_union_type: |
|
Jens Widell
2014/10/28 11:31:38
This ought to be moved to after the array/sequence
bashi
2014/10/29 01:34:32
Done.
|
| + return idl_type.name |
| + |
| # Array or sequence types |
| if used_as_variadic_argument: |
| native_array_element_type = idl_type |
| @@ -220,23 +223,11 @@ def cpp_type_initializer(idl_type): |
| return ' = nullptr' |
| -def cpp_type_union(idl_type, extended_attributes=None, raw_type=False): |
| - # FIXME: Need to revisit the design of union support. |
| - # http://crbug.com/240176 |
| - return None |
| - |
| - |
| -def cpp_type_initializer_union(idl_type): |
| - return (member_type.cpp_type_initializer for member_type in idl_type.member_types) |
| - |
| - |
| # Allow access as idl_type.cpp_type if no arguments |
| IdlTypeBase.cpp_type = property(cpp_type) |
| IdlTypeBase.cpp_type_initializer = property(cpp_type_initializer) |
| IdlTypeBase.cpp_type_args = cpp_type |
| -IdlUnionType.cpp_type = property(cpp_type_union) |
| -IdlUnionType.cpp_type_initializer = property(cpp_type_initializer_union) |
| -IdlUnionType.cpp_type_args = cpp_type_union |
| +IdlUnionType.cpp_type_initializer = '' |
| IdlArrayOrSequenceType.native_array_element_type = property( |
| @@ -484,6 +475,7 @@ def v8_conversion_needs_exception_state(idl_type): |
| IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_exception_state) |
| IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True |
| +IdlUnionType.v8_conversion_needs_exception_state = True |
| TRIVIAL_CONVERSIONS = frozenset([ |
| @@ -684,12 +676,8 @@ def v8_conversion_type(idl_type, extended_attributes): |
| """ |
| extended_attributes = extended_attributes or {} |
| - # FIXME: Support union type. |
| - if idl_type.is_union_type: |
| - return '' |
| - |
| - if idl_type.is_dictionary: |
| - return 'IDLDictionary' |
| + if idl_type.is_dictionary or idl_type.is_union_type: |
| + return 'StackAllocatedContainer' |
| # Array or sequence types |
| native_array_element_type = idl_type.native_array_element_type |
| @@ -757,7 +745,8 @@ V8_SET_RETURN_VALUE = { |
| 'DOMWrapperForMainWorld': 'v8SetReturnValueForMainWorld(info, WTF::getPtr({cpp_value}))', |
| 'DOMWrapperFast': 'v8SetReturnValueFast(info, WTF::getPtr({cpp_value}), {script_wrappable})', |
| 'DOMWrapperDefault': 'v8SetReturnValue(info, {cpp_value})', |
| - 'IDLDictionary': 'v8SetReturnValue(info, result)', |
| + # Union types or dictionaries |
| + 'StackAllocatedContainer': 'v8SetReturnValue(info, result)', |
| } |
| @@ -789,19 +778,10 @@ def v8_set_return_value(idl_type, cpp_value, extended_attributes=None, script_wr |
| return statement |
| -def v8_set_return_value_union(idl_type, cpp_value, extended_attributes=None, script_wrappable='', release=False, for_main_world=False): |
| - # FIXME: Need to revisit the design of union support. |
| - # http://crbug.com/240176 |
| - return None |
| - |
| - |
| IdlTypeBase.v8_set_return_value = v8_set_return_value |
| -IdlUnionType.v8_set_return_value = v8_set_return_value_union |
| IdlType.release = property(lambda self: self.is_interface_type) |
| -IdlUnionType.release = property( |
| - lambda self: [member_type.is_interface_type |
| - for member_type in self.member_types]) |
| +IdlUnionType.release = False |
| CPP_VALUE_TO_V8_VALUE = { |
| @@ -828,7 +808,8 @@ CPP_VALUE_TO_V8_VALUE = { |
| # General |
| 'array': 'v8Array({cpp_value}, {creation_context}, {isolate})', |
| 'DOMWrapper': 'toV8({cpp_value}, {creation_context}, {isolate})', |
| - 'IDLDictionary': 'toV8({cpp_value}, {creation_context}, {isolate})', |
| + # Union types and dictionaries |
| + 'StackAllocatedContainer': 'toV8({cpp_value}, {creation_context}, {isolate})', |
| } |