| Index: Source/bindings/scripts/v8_types.py
|
| diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
|
| index d6acc6067ffb8b9cb9f3d29932609987a944a021..f370d23878571db8bb5526354fa311a68c312226 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 + '*'
|
| @@ -367,6 +372,7 @@ def includes_for_type(idl_type):
|
| return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type],
|
| base_idl_type)])
|
|
|
| +
|
| IdlType.includes_for_type = property(includes_for_type)
|
| IdlUnionType.includes_for_type = property(
|
| lambda self: set.union(*[includes_for_type(member_type)
|
| @@ -387,11 +393,12 @@ def includes_for_interface(interface_name):
|
| def add_includes_for_interface(interface_name):
|
| includes.update(includes_for_interface(interface_name))
|
|
|
| +
|
| component_dir = {}
|
|
|
|
|
| def set_component_dirs(new_component_dirs):
|
| - component_dir.update(new_component_dirs)
|
| + component_dir.update(new_component_dirs)
|
|
|
|
|
| ################################################################################
|
|
|