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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 def dictionary_context(dictionary, interfaces_info): | 52 def dictionary_context(dictionary, interfaces_info): |
53 includes.clear() | 53 includes.clear() |
54 includes.update(DICTIONARY_CPP_INCLUDES) | 54 includes.update(DICTIONARY_CPP_INCLUDES) |
55 cpp_class = v8_utilities.cpp_name(dictionary) | 55 cpp_class = v8_utilities.cpp_name(dictionary) |
56 context = { | 56 context = { |
57 'cpp_class': cpp_class, | 57 'cpp_class': cpp_class, |
58 'header_includes': set(DICTIONARY_H_INCLUDES), | 58 'header_includes': set(DICTIONARY_H_INCLUDES), |
59 'members': [member_context(member) | 59 'members': [member_context(member) |
60 for member in sorted(dictionary.members, | 60 for member in sorted(dictionary.members, |
61 key=operator.attrgetter('name'))], | 61 key=operator.attrgetter('name'))], |
| 62 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in dictionary.extended_attributes, |
62 'v8_class': v8_types.v8_type(cpp_class), | 63 'v8_class': v8_types.v8_type(cpp_class), |
63 'v8_original_class': v8_types.v8_type(dictionary.name), | 64 'v8_original_class': v8_types.v8_type(dictionary.name), |
64 } | 65 } |
65 if dictionary.parent: | 66 if dictionary.parent: |
66 IdlType(dictionary.parent).add_includes_for_type() | 67 IdlType(dictionary.parent).add_includes_for_type() |
67 parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info( | 68 parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info( |
68 dictionary.parent, interfaces_info) | 69 dictionary.parent, interfaces_info) |
69 context.update({ | 70 context.update({ |
70 'parent_cpp_class': parent_cpp_class, | 71 'parent_cpp_class': parent_cpp_class, |
71 'parent_v8_class': v8_types.v8_type(parent_cpp_class), | 72 'parent_v8_class': v8_types.v8_type(parent_cpp_class), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 'getter_expression': getter_expression(), | 175 'getter_expression': getter_expression(), |
175 'has_method_expression': has_method_expression(), | 176 'has_method_expression': has_method_expression(), |
176 'has_method_name': has_method_name_for_dictionary_member(member), | 177 'has_method_name': has_method_name_for_dictionary_member(member), |
177 'is_object': is_object, | 178 'is_object': is_object, |
178 'is_traceable': idl_type.is_traceable, | 179 'is_traceable': idl_type.is_traceable, |
179 'member_cpp_type': member_cpp_type(), | 180 'member_cpp_type': member_cpp_type(), |
180 'null_setter_name': null_setter_name_for_dictionary_member(member), | 181 'null_setter_name': null_setter_name_for_dictionary_member(member), |
181 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 182 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
182 'setter_name': setter_name_for_dictionary_member(member), | 183 'setter_name': setter_name_for_dictionary_member(member), |
183 } | 184 } |
OLD | NEW |