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 """Generate template contexts of dictionaries for both v8 bindings and | 5 """Generate template contexts of dictionaries for both v8 bindings and |
6 implementation classes that are used by blink's core/modules. | 6 implementation classes that are used by blink's core/modules. |
7 """ | 7 """ |
8 | 8 |
9 import operator | 9 import operator |
10 from idl_types import IdlType | 10 from idl_types import IdlType |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 'is_interface_type': idl_type.is_interface_type and not idl_type.is_dict
ionary, | 108 'is_interface_type': idl_type.is_interface_type and not idl_type.is_dict
ionary, |
109 'is_nullable': idl_type.is_nullable, | 109 'is_nullable': idl_type.is_nullable, |
110 'is_object': unwrapped_idl_type.name == 'Object', | 110 'is_object': unwrapped_idl_type.name == 'Object', |
111 'name': member.name, | 111 'name': member.name, |
112 'setter_name': setter_name_for_dictionary_member(member), | 112 'setter_name': setter_name_for_dictionary_member(member), |
113 'null_setter_name': null_setter_name_for_dictionary_member(member), | 113 'null_setter_name': null_setter_name_for_dictionary_member(member), |
114 'use_output_parameter_for_result': unwrapped_idl_type.use_output_paramet
er_for_result, | 114 'use_output_parameter_for_result': unwrapped_idl_type.use_output_paramet
er_for_result, |
115 'v8_default_value': v8_default_value, | 115 'v8_default_value': v8_default_value, |
116 'v8_value_to_local_cpp_value': unwrapped_idl_type.v8_value_to_local_cpp_
value( | 116 'v8_value_to_local_cpp_value': unwrapped_idl_type.v8_value_to_local_cpp_
value( |
117 member.extended_attributes, member.name + 'Value', | 117 member.extended_attributes, member.name + 'Value', |
118 member.name, isolate='isolate'), | 118 member.name, isolate='isolate', restricted_float=True), |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 # Context for implementation classes | 122 # Context for implementation classes |
123 | 123 |
124 def dictionary_impl_context(dictionary, interfaces_info): | 124 def dictionary_impl_context(dictionary, interfaces_info): |
125 def remove_duplicate_members(members): | 125 def remove_duplicate_members(members): |
126 # When [ImplementedAs] is used, cpp_name can conflict. For example, | 126 # When [ImplementedAs] is used, cpp_name can conflict. For example, |
127 # dictionary D { long foo; [ImplementedAs=foo, DeprecateAs=Foo] long old
Foo; }; | 127 # dictionary D { long foo; [ImplementedAs=foo, DeprecateAs=Foo] long old
Foo; }; |
128 # This function removes such duplications, checking they have the same t
ype. | 128 # This function removes such duplications, checking they have the same t
ype. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 'getter_expression': getter_expression(), | 190 'getter_expression': getter_expression(), |
191 'has_method_expression': has_method_expression(), | 191 'has_method_expression': has_method_expression(), |
192 'has_method_name': has_method_name_for_dictionary_member(member), | 192 'has_method_name': has_method_name_for_dictionary_member(member), |
193 'is_object': is_object, | 193 'is_object': is_object, |
194 'is_traceable': idl_type.is_traceable, | 194 'is_traceable': idl_type.is_traceable, |
195 'member_cpp_type': member_cpp_type(), | 195 'member_cpp_type': member_cpp_type(), |
196 'null_setter_name': null_setter_name_for_dictionary_member(member), | 196 'null_setter_name': null_setter_name_for_dictionary_member(member), |
197 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 197 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
198 'setter_name': setter_name_for_dictionary_member(member), | 198 'setter_name': setter_name_for_dictionary_member(member), |
199 } | 199 } |
OLD | NEW |