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..318e160ef569b9ab4be1c484d3e7d95f7ea26818 100644 |
--- a/Source/bindings/scripts/v8_types.py |
+++ b/Source/bindings/scripts/v8_types.py |
@@ -162,6 +162,9 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_ |
return 'const %s&' % vector_template_type |
return vector_template_type |
+ if idl_type.is_union_type: |
+ return idl_type.name |
+ |
# Simple types |
base_idl_type = idl_type.base_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 |
Jens Widell
2014/10/29 11:40:45
This isn't needed; all properties on IdlBaseType s
|
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})', |
} |