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 d6acc6067ffb8b9cb9f3d29932609987a944a021..f1cff627432c4082d08b2c2c5db729102066aec9 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): |
|
haraken
2014/07/27 07:46:36
What's a difference between used_as_argument and u
bashi
2014/07/29 03:52:51
Removed and renamed used_as_argument to used_as_rv
|
| """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: |
|
haraken
2014/07/27 07:46:36
I'd prefer used_in_cpp_sequence, since "member" is
bashi
2014/07/29 03:52:51
Reverted the rename. But in fact, it seems that we
haraken
2014/07/29 11:09:19
It's true that oilpan's member is used in the cont
bashi
2014/07/29 11:51:20
I see. Thank you for clarification.
|
| + 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 + '*' |
| @@ -387,11 +392,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) |
| ################################################################################ |