| Index: Source/bindings/scripts/v8_types.py
|
| diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
|
| index 0a070f8074c00ca2bed6b7a4c1d70b52bf6b4bee..ce9938c99657e91ca22995abfd92c87d751823bc 100644
|
| --- a/Source/bindings/scripts/v8_types.py
|
| +++ b/Source/bindings/scripts/v8_types.py
|
| @@ -120,7 +120,8 @@ CPP_SPECIAL_CONVERSION_RULES = {
|
| }
|
|
|
|
|
| -def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argument=False, used_as_variadic_argument=False, used_in_cpp_sequence=False):
|
| +# FIXME: too many flags.
|
| +def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argument=False, used_as_variadic_argument=False, used_as_member=False, used_as_return_type=False):
|
| """Returns C++ type corresponding to IDL type.
|
|
|
| |idl_type| argument is of type IdlType, while return value is a string
|
| @@ -134,8 +135,11 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen
|
| bool, True if the C++ type is used as an argument of a method.
|
| used_as_variadic_argument:
|
| bool, True if the C++ type is used as a variadic argument of a method.
|
| - used_in_cpp_sequence:
|
| - bool, True if the C++ type is used as an element of an array or sequence.
|
| + used_as_member:
|
| + bool, True if the C++ type is used as a member of a container.
|
| + Containers can be an array, a sequence or a dictionary.
|
| + used_as_return_type:
|
| + bool, True if the C++ type is used as a return type of a method.
|
| """
|
| def string_mode():
|
| if extended_attributes.get('TreatNullAs') == 'EmptyString':
|
| @@ -156,7 +160,8 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen
|
| native_array_element_type = idl_type.native_array_element_type
|
| if native_array_element_type:
|
| vector_type = cpp_ptr_type('Vector', 'HeapVector', native_array_element_type.gc_type)
|
| - return cpp_template_type(vector_type, native_array_element_type.cpp_type_args(used_in_cpp_sequence=True))
|
| + vector_template_type = cpp_template_type(vector_type, native_array_element_type.cpp_type_args(used_as_member=True))
|
| + return vector_template_type
|
|
|
| # Simple types
|
| base_idl_type = idl_type.base_type
|
| @@ -171,7 +176,7 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen
|
| return CPP_SPECIAL_CONVERSION_RULES[base_idl_type]
|
|
|
| if base_idl_type in NON_WRAPPER_TYPES:
|
| - return ('PassRefPtr<%s>' if used_as_argument else 'RefPtr<%s>') % base_idl_type
|
| + return ('PassRefPtr<%s>' if used_as_argument or used_as_return_type else 'RefPtr<%s>') % base_idl_type
|
| if idl_type.is_string_type:
|
| if not raw_type:
|
| return 'String'
|
| @@ -183,8 +188,8 @@ def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen
|
| implemented_as_class = idl_type.implemented_as
|
| if raw_type:
|
| return implemented_as_class + '*'
|
| - new_type = 'Member' if used_in_cpp_sequence else 'RawPtr'
|
| - ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_argument else 'RefPtr'), new_type, idl_type.gc_type)
|
| + new_type = 'Member' if used_as_member else 'RawPtr'
|
| + ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_argument or used_as_return_type else 'RefPtr'), new_type, idl_type.gc_type)
|
| return cpp_template_type(ptr_type, implemented_as_class)
|
| # Default, assume native type is a pointer with same type name as idl type
|
| return base_idl_type + '*'
|
| @@ -458,6 +463,8 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
|
| cpp_expression_format = (
|
| '{v8_value}->Is{idl_type}() ? '
|
| 'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0')
|
| + elif idl_type.is_dictionary:
|
| + cpp_expression_format = 'V8{idl_type}::toNative({isolate}, {v8_value})'
|
| else:
|
| cpp_expression_format = (
|
| 'V8{idl_type}::toNativeWithTypeCheck({isolate}, {v8_value})')
|
|
|