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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 'cpp_class': v8_utilities.cpp_name(dictionary), | 166 'cpp_class': v8_utilities.cpp_name(dictionary), |
167 'members': members, | 167 'members': members, |
168 } | 168 } |
169 if dictionary.parent: | 169 if dictionary.parent: |
170 context['parent_cpp_class'] = v8_utilities.cpp_name_from_interfaces_info
( | 170 context['parent_cpp_class'] = v8_utilities.cpp_name_from_interfaces_info
( |
171 dictionary.parent, interfaces_info) | 171 dictionary.parent, interfaces_info) |
172 parent_interface_info = interfaces_info.get(dictionary.parent) | 172 parent_interface_info = interfaces_info.get(dictionary.parent) |
173 if parent_interface_info: | 173 if parent_interface_info: |
174 context['header_includes'].add( | 174 context['header_includes'].add( |
175 parent_interface_info['include_path']) | 175 parent_interface_info['include_path']) |
| 176 else: |
| 177 context['parent_cpp_class'] = 'IDLDictionaryBase' |
| 178 context['header_includes'].add( |
| 179 'bindings/core/v8/IDLDictionaryBase.h') |
176 return context | 180 return context |
177 | 181 |
178 | 182 |
179 def member_impl_context(member, interfaces_info, header_includes): | 183 def member_impl_context(member, interfaces_info, header_includes): |
180 idl_type = unwrap_nullable_if_needed(member.idl_type) | 184 idl_type = unwrap_nullable_if_needed(member.idl_type) |
181 cpp_name = v8_utilities.cpp_name(member) | 185 cpp_name = v8_utilities.cpp_name(member) |
182 | 186 |
183 def getter_expression(): | 187 def getter_expression(): |
184 if idl_type.impl_should_use_nullable_container: | 188 if idl_type.impl_should_use_nullable_container: |
185 return 'm_%s.get()' % cpp_name | 189 return 'm_%s.get()' % cpp_name |
(...skipping 26 matching lines...) Expand all Loading... |
212 'getter_expression': getter_expression(), | 216 'getter_expression': getter_expression(), |
213 'has_method_expression': has_method_expression(), | 217 'has_method_expression': has_method_expression(), |
214 'has_method_name': has_method_name_for_dictionary_member(member), | 218 'has_method_name': has_method_name_for_dictionary_member(member), |
215 'is_nullable': idl_type.is_nullable, | 219 'is_nullable': idl_type.is_nullable, |
216 'is_traceable': idl_type.is_traceable, | 220 'is_traceable': idl_type.is_traceable, |
217 'member_cpp_type': member_cpp_type(), | 221 'member_cpp_type': member_cpp_type(), |
218 'null_setter_name': null_setter_name_for_dictionary_member(member), | 222 'null_setter_name': null_setter_name_for_dictionary_member(member), |
219 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 223 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
220 'setter_name': setter_name_for_dictionary_member(member), | 224 'setter_name': setter_name_for_dictionary_member(member), |
221 } | 225 } |
OLD | NEW |