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

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

Issue 1807843002: [Binding] Include RuntimeEnabledFeature.h if a dictionary has a RuntimeEnabledFeature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 if idl_type.is_nullable: 46 if idl_type.is_nullable:
47 return idl_type.inner_type 47 return idl_type.inner_type
48 return idl_type 48 return idl_type
49 49
50 50
51 # Context for V8 bindings 51 # Context for V8 bindings
52 52
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
57 members = [member_context(dictionary, member)
58 for member in sorted(dictionary.members,
59 key=operator.attrgetter('name'))]
60
61 for member in members:
bashi 2016/03/16 07:18:07 nit: you can also write this like: if any(member[
62 if member['runtime_enabled_function']:
63 includes.add('platform/RuntimeEnabledFeatures.h')
64 break
65
56 cpp_class = v8_utilities.cpp_name(dictionary) 66 cpp_class = v8_utilities.cpp_name(dictionary)
57 context = { 67 context = {
58 'cpp_class': cpp_class, 68 'cpp_class': cpp_class,
59 'header_includes': set(DICTIONARY_H_INCLUDES), 69 'header_includes': set(DICTIONARY_H_INCLUDES),
60 'members': [member_context(dictionary, member) 70 'members': members,
61 for member in sorted(dictionary.members,
62 key=operator.attrgetter('name'))],
63 'required_member_names': sorted([member.name 71 'required_member_names': sorted([member.name
64 for member in dictionary.members 72 for member in dictionary.members
65 if member.is_required]), 73 if member.is_required]),
66 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in dictionary.extended_attributes, 74 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in dictionary.extended_attributes,
67 'v8_class': v8_types.v8_type(cpp_class), 75 'v8_class': v8_types.v8_type(cpp_class),
68 'v8_original_class': v8_types.v8_type(dictionary.name), 76 'v8_original_class': v8_types.v8_type(dictionary.name),
69 } 77 }
70 if dictionary.parent: 78 if dictionary.parent:
71 IdlType(dictionary.parent).add_includes_for_type() 79 IdlType(dictionary.parent).add_includes_for_type()
72 parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info( 80 parent_cpp_class = v8_utilities.cpp_name_from_interfaces_info(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 'getter_expression': getter_expression(), 212 'getter_expression': getter_expression(),
205 'has_method_expression': has_method_expression(), 213 'has_method_expression': has_method_expression(),
206 'has_method_name': has_method_name_for_dictionary_member(member), 214 'has_method_name': has_method_name_for_dictionary_member(member),
207 'is_nullable': idl_type.is_nullable, 215 'is_nullable': idl_type.is_nullable,
208 'is_traceable': idl_type.is_traceable, 216 'is_traceable': idl_type.is_traceable,
209 'member_cpp_type': member_cpp_type(), 217 'member_cpp_type': member_cpp_type(),
210 'null_setter_name': null_setter_name_for_dictionary_member(member), 218 'null_setter_name': null_setter_name_for_dictionary_member(member),
211 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 219 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
212 'setter_name': setter_name_for_dictionary_member(member), 220 'setter_name': setter_name_for_dictionary_member(member),
213 } 221 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698