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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 def dictionary_context(dictionary, interfaces_info): | 53 def dictionary_context(dictionary, interfaces_info): |
54 includes.clear() | 54 includes.clear() |
55 includes.update(DICTIONARY_CPP_INCLUDES) | 55 includes.update(DICTIONARY_CPP_INCLUDES) |
56 cpp_class = v8_utilities.cpp_name(dictionary) | 56 cpp_class = v8_utilities.cpp_name(dictionary) |
57 context = { | 57 context = { |
58 'cpp_class': cpp_class, | 58 'cpp_class': cpp_class, |
59 'header_includes': set(DICTIONARY_H_INCLUDES), | 59 'header_includes': set(DICTIONARY_H_INCLUDES), |
60 'members': [member_context(dictionary, member) | 60 'members': [member_context(dictionary, member) |
61 for member in sorted(dictionary.members, | 61 for member in sorted(dictionary.members, |
62 key=operator.attrgetter('name'))], | 62 key=operator.attrgetter('name'))], |
| 63 'required_member_names': sorted([member.name |
| 64 for member in dictionary.members |
| 65 if member.is_required]), |
63 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in dictionary.extended_attributes, | 66 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in dictionary.extended_attributes, |
64 'v8_class': v8_types.v8_type(cpp_class), | 67 'v8_class': v8_types.v8_type(cpp_class), |
65 'v8_original_class': v8_types.v8_type(dictionary.name), | 68 'v8_original_class': v8_types.v8_type(dictionary.name), |
66 } | 69 } |
67 if dictionary.parent: | 70 if dictionary.parent: |
68 IdlType(dictionary.parent).add_includes_for_type() | 71 IdlType(dictionary.parent).add_includes_for_type() |
69 parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info( | 72 parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info( |
70 dictionary.parent, interfaces_info) | 73 dictionary.parent, interfaces_info) |
71 context.update({ | 74 context.update({ |
72 'parent_cpp_class': parent_cpp_class, | 75 'parent_cpp_class': parent_cpp_class, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 'getter_expression': getter_expression(), | 204 'getter_expression': getter_expression(), |
202 'has_method_expression': has_method_expression(), | 205 'has_method_expression': has_method_expression(), |
203 'has_method_name': has_method_name_for_dictionary_member(member), | 206 'has_method_name': has_method_name_for_dictionary_member(member), |
204 'is_nullable': idl_type.is_nullable, | 207 'is_nullable': idl_type.is_nullable, |
205 'is_traceable': idl_type.is_traceable, | 208 'is_traceable': idl_type.is_traceable, |
206 'member_cpp_type': member_cpp_type(), | 209 'member_cpp_type': member_cpp_type(), |
207 'null_setter_name': null_setter_name_for_dictionary_member(member), | 210 'null_setter_name': null_setter_name_for_dictionary_member(member), |
208 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 211 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
209 'setter_name': setter_name_for_dictionary_member(member), | 212 'setter_name': setter_name_for_dictionary_member(member), |
210 } | 213 } |
OLD | NEW |