OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import v8_utilities | 5 import v8_utilities |
6 | 6 |
7 | 7 |
8 UNION_H_INCLUDES = frozenset([ | 8 UNION_H_INCLUDES = frozenset([ |
9 'bindings/core/v8/ExceptionState.h', | 9 'bindings/core/v8/ExceptionState.h', |
10 'bindings/core/v8/V8Binding.h', | 10 'bindings/core/v8/V8Binding.h', |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 string_type = context | 58 string_type = context |
59 else: | 59 else: |
60 raise Exception('%s is not supported as an union member.' % member.n ame) | 60 raise Exception('%s is not supported as an union member.' % member.n ame) |
61 | 61 |
62 return { | 62 return { |
63 'boolean_type': boolean_type, | 63 'boolean_type': boolean_type, |
64 'cpp_class': union_type.name, | 64 'cpp_class': union_type.name, |
65 'dictionary_type': dictionary_type, | 65 'dictionary_type': dictionary_type, |
66 'interface_types': interface_types, | 66 'interface_types': interface_types, |
67 'members': members, | 67 'members': members, |
68 'needs_trace': any(member['is_traceable'] for member in members), | |
68 'numeric_type': numeric_type, | 69 'numeric_type': numeric_type, |
69 'string_type': string_type, | 70 'string_type': string_type, |
70 } | 71 } |
71 | 72 |
72 | 73 |
73 def member_context(member, interfaces_info): | 74 def member_context(member, interfaces_info): |
74 cpp_includes.update(member.includes_for_type) | 75 cpp_includes.update(member.includes_for_type) |
75 interface_info = interfaces_info.get(member.name, None) | 76 interface_info = interfaces_info.get(member.name, None) |
76 if interface_info: | 77 if interface_info: |
77 cpp_includes.update(interface_info.get('dependencies_include_paths', []) ) | 78 cpp_includes.update(interface_info.get('dependencies_include_paths', []) ) |
78 header_forward_decls.add(member.name) | 79 header_forward_decls.add(member.name) |
79 return { | 80 return { |
80 'cpp_name': v8_utilities.uncapitalize(member.name), | 81 'cpp_name': v8_utilities.uncapitalize(member.name), |
81 'cpp_type': member.cpp_type_args(used_in_cpp_sequence=True), | 82 'cpp_type': member.cpp_type_args(used_in_cpp_sequence=True), |
82 'cpp_local_type': member.cpp_type, | 83 'cpp_local_type': member.cpp_type, |
83 'cpp_value_to_v8_value': member.cpp_value_to_v8_value( | 84 'cpp_value_to_v8_value': member.cpp_value_to_v8_value( |
84 cpp_value='impl.getAs%s()' % member.name, isolate='isolate', | 85 cpp_value='impl.getAs%s()' % member.name, isolate='isolate', |
85 creation_context='creationContext'), | 86 creation_context='creationContext'), |
87 'is_traceable': (member.is_garbage_collected or | |
sof
2014/10/31 07:30:12
Might be worth lifting out into a helper in v8_typ
Jens Widell
2014/10/31 07:48:46
Yes. I'll follow up with that.
| |
88 member.is_will_be_garbage_collected), | |
86 'rvalue_cpp_type': member.cpp_type_args(used_as_rvalue_type=True), | 89 'rvalue_cpp_type': member.cpp_type_args(used_as_rvalue_type=True), |
87 'specific_type_enum': 'SpecificType' + member.name, | 90 'specific_type_enum': 'SpecificType' + member.name, |
88 'type_name': member.name, | 91 'type_name': member.name, |
89 'v8_value_to_local_cpp_value': member.v8_value_to_local_cpp_value( | 92 'v8_value_to_local_cpp_value': member.v8_value_to_local_cpp_value( |
90 {}, 'v8Value', 'cppValue', needs_exception_state_for_string=True), | 93 {}, 'v8Value', 'cppValue', needs_exception_state_for_string=True), |
91 } | 94 } |
OLD | NEW |