Chromium Code Reviews| Index: Source/bindings/scripts/unstable/v8_types.py |
| diff --git a/Source/bindings/scripts/unstable/v8_types.py b/Source/bindings/scripts/unstable/v8_types.py |
| index b08780ac4580bf9a6be7b824ad19307e51334a00..9d8412076fe85356076f8f7f20d8684e5fa78e4b 100644 |
| --- a/Source/bindings/scripts/unstable/v8_types.py |
| +++ b/Source/bindings/scripts/unstable/v8_types.py |
| @@ -247,7 +247,8 @@ CPP_SPECIAL_CONVERSION_RULES = { |
| 'boolean': 'bool', |
| } |
| -def cpp_type(idl_type, extended_attributes=None, used_as_argument=False): |
| + |
| +def cpp_type(idl_type, extended_attributes=None, used_as_argument=False, used_as_member=False): |
|
haraken
2014/02/27 15:32:43
Is |used_as_member| necessary?
Nils Barth (inactive)
2014/03/03 02:47:53
Keishi, could you add some documentation to the do
|
| """Returns C++ type corresponding to IDL type.""" |
| def string_mode(): |
| # FIXME: the Web IDL spec requires 'EmptyString', not 'NullString', |
| @@ -282,6 +283,8 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False): |
| for union_member_type in idl_type.union_member_types) |
| this_array_or_sequence_type = array_or_sequence_type(idl_type) |
| if this_array_or_sequence_type: |
| + if is_will_be_garbage_collected(this_array_or_sequence_type): |
| + return cpp_template_type('WillBeHeapVector', cpp_type(this_array_or_sequence_type, used_as_member=True)) |
|
haraken
2014/02/27 15:32:43
I don't quite understand that you're adding |used_
Nils Barth (inactive)
2014/03/03 02:47:53
? Keishi's code makes sense AFAICT;
it's using |us
|
| return cpp_template_type('Vector', cpp_type(this_array_or_sequence_type)) |
| if is_typed_array_type(idl_type) and used_as_argument: |
| @@ -291,6 +294,8 @@ def cpp_type(idl_type, extended_attributes=None, used_as_argument=False): |
| if used_as_argument: |
| return implemented_as_class + '*' |
| if is_will_be_garbage_collected(idl_type): |
| + if used_as_member: |
| + return cpp_template_type('RefPtrWillBeMember', implemented_as_class) |
| return cpp_template_type('RefPtrWillBeRawPtr', implemented_as_class) |
| return cpp_template_type('RefPtr', implemented_as_class) |
| # Default, assume native type is a pointer with same type name as idl type |
| @@ -469,7 +474,10 @@ def v8_value_to_cpp_value_array_or_sequence(this_array_or_sequence_type, v8_valu |
| if (is_interface_type(this_array_or_sequence_type) and |
| this_array_or_sequence_type != 'Dictionary'): |
| this_cpp_type = None |
| - expression_format = '(toRefPtrNativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))' |
| + if is_will_be_garbage_collected(this_array_or_sequence_type): |
| + expression_format = '(toMemberNativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))' |
|
sof
2014/03/02 20:10:55
To my eyes, it would read better if you instead cr
|
| + else: |
| + expression_format = '(toRefPtrNativeArray<{array_or_sequence_type}, V8{array_or_sequence_type}>({v8_value}, {index}, info.GetIsolate()))' |
| add_includes_for_type(this_array_or_sequence_type) |
| else: |
| this_cpp_type = cpp_type(this_array_or_sequence_type) |