Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_dictionary.py

Issue 2578943002: [Bindings] Refactoring of binding code around runtime enabled features (Closed)
Patch Set: Work for a comment Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 if 'RuntimeEnabled' in dictionary.extended_attributes: 57 if 'RuntimeEnabled' in dictionary.extended_attributes:
58 raise Exception( 58 raise Exception(
59 'Dictionary cannot be RuntimeEnabled: %s' % dictionary.name) 59 'Dictionary cannot be RuntimeEnabled: %s' % dictionary.name)
60 60
61 members = [member_context(dictionary, member) 61 members = [member_context(dictionary, member)
62 for member in sorted(dictionary.members, 62 for member in sorted(dictionary.members,
63 key=operator.attrgetter('name'))] 63 key=operator.attrgetter('name'))]
64 64
65 for member in members: 65 for member in members:
66 if member['runtime_enabled_function']: 66 if member['runtime_enabled_feature_name']:
67 includes.add('platform/RuntimeEnabledFeatures.h') 67 includes.add('platform/RuntimeEnabledFeatures.h')
68 break 68 break
69 69
70 cpp_class = v8_utilities.cpp_name(dictionary) 70 cpp_class = v8_utilities.cpp_name(dictionary)
71 context = { 71 context = {
72 'cpp_class': cpp_class, 72 'cpp_class': cpp_class,
73 'header_includes': set(DICTIONARY_H_INCLUDES), 73 'header_includes': set(DICTIONARY_H_INCLUDES),
74 'members': members, 74 'members': members,
75 'required_member_names': sorted([member.name 75 'required_member_names': sorted([member.name
76 for member in dictionary.members 76 for member in dictionary.members
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 'deprecate_as': v8_utilities.deprecate_as(member), 127 'deprecate_as': v8_utilities.deprecate_as(member),
128 'enum_type': idl_type.enum_type, 128 'enum_type': idl_type.enum_type,
129 'enum_values': unwrapped_idl_type.enum_values, 129 'enum_values': unwrapped_idl_type.enum_values,
130 'has_method_name': has_method_name_for_dictionary_member(member), 130 'has_method_name': has_method_name_for_dictionary_member(member),
131 'idl_type': idl_type.base_type, 131 'idl_type': idl_type.base_type,
132 'is_interface_type': idl_type.is_interface_type and not is_deprecated_di ctionary, 132 'is_interface_type': idl_type.is_interface_type and not is_deprecated_di ctionary,
133 'is_nullable': idl_type.is_nullable, 133 'is_nullable': idl_type.is_nullable,
134 'is_object': unwrapped_idl_type.name == 'Object' or is_deprecated_dictio nary, 134 'is_object': unwrapped_idl_type.name == 'Object' or is_deprecated_dictio nary,
135 'is_required': member.is_required, 135 'is_required': member.is_required,
136 'name': member.name, 136 'name': member.name,
137 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ember), # [RuntimeEnabled] 137 'runtime_enabled_feature_name': v8_utilities.runtime_enabled_feature_nam e(member), # [RuntimeEnabled]
138 'setter_name': setter_name_for_dictionary_member(member), 138 'setter_name': setter_name_for_dictionary_member(member),
139 'null_setter_name': null_setter_name_for_dictionary_member(member), 139 'null_setter_name': null_setter_name_for_dictionary_member(member),
140 'v8_default_value': v8_default_value, 140 'v8_default_value': v8_default_value,
141 'v8_value_to_local_cpp_value': unwrapped_idl_type.v8_value_to_local_cpp_ value( 141 'v8_value_to_local_cpp_value': unwrapped_idl_type.v8_value_to_local_cpp_ value(
142 extended_attributes, member.name + 'Value', 142 extended_attributes, member.name + 'Value',
143 member.name, isolate='isolate', use_exception_state=True), 143 member.name, isolate='isolate', use_exception_state=True),
144 } 144 }
145 145
146 146
147 # Context for implementation classes 147 # Context for implementation classes
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 'has_method_expression': has_method_expression(), 226 'has_method_expression': has_method_expression(),
227 'has_method_name': has_method_name_for_dictionary_member(member), 227 'has_method_name': has_method_name_for_dictionary_member(member),
228 'is_nullable': idl_type.is_nullable, 228 'is_nullable': idl_type.is_nullable,
229 'is_traceable': idl_type.is_traceable, 229 'is_traceable': idl_type.is_traceable,
230 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True), 230 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True),
231 'null_setter_name': null_setter_name_for_dictionary_member(member), 231 'null_setter_name': null_setter_name_for_dictionary_member(member),
232 'nullable_indicator_name': nullable_indicator_name, 232 'nullable_indicator_name': nullable_indicator_name,
233 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 233 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
234 'setter_name': setter_name_for_dictionary_member(member), 234 'setter_name': setter_name_for_dictionary_member(member),
235 } 235 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698