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

Side by Side Diff: Source/bindings/scripts/generate_global_constructors.py

Issue 1107523002: IDL: Drop [PerContextEnabled] extended attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 8 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Generates interface properties on global objects. 7 """Generates interface properties on global objects.
8 8
9 Concretely these are implemented as "constructor attributes", meaning 9 Concretely these are implemented as "constructor attributes", meaning
10 "attributes whose name ends with Constructor" (special-cased by code generator), 10 "attributes whose name ends with Constructor" (special-cased by code generator),
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 # Exposed=env or Exposed=(env1,...) case 96 # Exposed=env or Exposed=(env1,...) case
97 exposed_global_names = extended_attributes.get('Exposed', 'Window').stri p('()').split(',') 97 exposed_global_names = extended_attributes.get('Exposed', 'Window').stri p('()').split(',')
98 new_constructors_list = generate_global_constructors_list(interface_name , extended_attributes) 98 new_constructors_list = generate_global_constructors_list(interface_name , extended_attributes)
99 for name in exposed_global_names: 99 for name in exposed_global_names:
100 global_name_to_constructors[name].extend(new_constructors_list) 100 global_name_to_constructors[name].extend(new_constructors_list)
101 101
102 102
103 def generate_global_constructors_list(interface_name, extended_attributes): 103 def generate_global_constructors_list(interface_name, extended_attributes):
104 extended_attributes_list = [ 104 extended_attributes_list = [
105 name + '=' + extended_attributes[name] 105 name + '=' + extended_attributes[name]
106 for name in 'Conditional', 'PerContextEnabled', 'RuntimeEnabled' 106 for name in 'Conditional', 'RuntimeEnabled'
107 if name in extended_attributes] 107 if name in extended_attributes]
108 if extended_attributes_list: 108 if extended_attributes_list:
109 extended_string = '[%s] ' % ', '.join(extended_attributes_list) 109 extended_string = '[%s] ' % ', '.join(extended_attributes_list)
110 else: 110 else:
111 extended_string = '' 111 extended_string = ''
112 112
113 attribute_string = 'attribute {interface_name}Constructor {interface_name}'. format(interface_name=interface_name) 113 attribute_string = 'attribute {interface_name}Constructor {interface_name}'. format(interface_name=interface_name)
114 attributes_list = [extended_string + attribute_string] 114 attributes_list = [extended_string + attribute_string]
115 115
116 # In addition to the usual interface property, for every [NamedConstructor] 116 # In addition to the usual interface property, for every [NamedConstructor]
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 constructors = interface_name_to_constructors(interface_name) 181 constructors = interface_name_to_constructors(interface_name)
182 write_global_constructors_partial_interface( 182 write_global_constructors_partial_interface(
183 interface_name, 183 interface_name,
184 idl_filename, 184 idl_filename,
185 constructors, 185 constructors,
186 options.write_file_only_if_changed) 186 options.write_file_only_if_changed)
187 187
188 188
189 if __name__ == '__main__': 189 if __name__ == '__main__':
190 sys.exit(main()) 190 sys.exit(main())
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.py ('k') | Source/bindings/scripts/interface_dependency_resolver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698