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

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

Issue 2837923003: Make NodeFilter a legacy callback interface. (Closed)
Patch Set: legacy_callback_interface.*.tmpl, etc. Created 3 years, 7 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 12 matching lines...) Expand all
23 import optparse 23 import optparse
24 import os 24 import os
25 import re 25 import re
26 import sys 26 import sys
27 27
28 from collections import defaultdict 28 from collections import defaultdict
29 from utilities import get_file_contents 29 from utilities import get_file_contents
30 from utilities import get_interface_exposed_arguments 30 from utilities import get_interface_exposed_arguments
31 from utilities import get_interface_extended_attributes_from_idl 31 from utilities import get_interface_extended_attributes_from_idl
32 from utilities import idl_filename_to_interface_name 32 from utilities import idl_filename_to_interface_name
33 from utilities import is_callback_interface_from_idl 33 from utilities import is_non_legacy_callback_interface_from_idl
34 from utilities import read_file_to_list 34 from utilities import read_file_to_list
35 from utilities import read_pickle_file 35 from utilities import read_pickle_file
36 from utilities import should_generate_impl_file_from_idl 36 from utilities import should_generate_impl_file_from_idl
37 from utilities import write_file 37 from utilities import write_file
38 from v8_utilities import EXPOSED_EXECUTION_CONTEXT_METHOD 38 from v8_utilities import EXPOSED_EXECUTION_CONTEXT_METHOD
39 39
40 interface_name_to_global_names = {} 40 interface_name_to_global_names = {}
41 global_name_to_constructors = defaultdict(list) 41 global_name_to_constructors = defaultdict(list)
42 42
43 43
(...skipping 28 matching lines...) Expand all
72 72
73 73
74 def record_global_constructors(idl_filename): 74 def record_global_constructors(idl_filename):
75 interface_name = idl_filename_to_interface_name(idl_filename) 75 interface_name = idl_filename_to_interface_name(idl_filename)
76 full_path = os.path.realpath(idl_filename) 76 full_path = os.path.realpath(idl_filename)
77 idl_file_contents = get_file_contents(full_path) 77 idl_file_contents = get_file_contents(full_path)
78 extended_attributes = get_interface_extended_attributes_from_idl(idl_file_co ntents) 78 extended_attributes = get_interface_extended_attributes_from_idl(idl_file_co ntents)
79 79
80 # An interface property is produced for every non-callback interface 80 # An interface property is produced for every non-callback interface
81 # that does not have [NoInterfaceObject]. 81 # that does not have [NoInterfaceObject].
82 # Callback interfaces with constants also have interface properties,
83 # but there are none of these in Blink.
84 # http://heycam.github.io/webidl/#es-interfaces 82 # http://heycam.github.io/webidl/#es-interfaces
85 if ((not should_generate_impl_file_from_idl(idl_file_contents)) or 83 if ((not should_generate_impl_file_from_idl(idl_file_contents)) or
86 is_callback_interface_from_idl(idl_file_contents) or 84 is_non_legacy_callback_interface_from_idl(idl_file_contents) or
87 'NoInterfaceObject' in extended_attributes): 85 'NoInterfaceObject' in extended_attributes):
88 return 86 return
89 87
90 exposed_arguments = get_interface_exposed_arguments(idl_file_contents) 88 exposed_arguments = get_interface_exposed_arguments(idl_file_contents)
91 if exposed_arguments: 89 if exposed_arguments:
92 # Exposed(Arguments) case 90 # Exposed(Arguments) case
93 for argument in exposed_arguments: 91 for argument in exposed_arguments:
94 if 'RuntimeEnabled' in extended_attributes: 92 if 'RuntimeEnabled' in extended_attributes:
95 raise ValueError('RuntimeEnabled should not be used with Exposed (Arguments)') 93 raise ValueError('RuntimeEnabled should not be used with Exposed (Arguments)')
96 attributes = extended_attributes.copy() 94 attributes = extended_attributes.copy()
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 # Write partial interfaces containing constructor attributes for each 179 # Write partial interfaces containing constructor attributes for each
182 # global interface. 180 # global interface.
183 for interface_name, idl_filename in interface_name_idl_filename: 181 for interface_name, idl_filename in interface_name_idl_filename:
184 constructors = interface_name_to_constructors(interface_name) 182 constructors = interface_name_to_constructors(interface_name)
185 write_global_constructors_partial_interface( 183 write_global_constructors_partial_interface(
186 interface_name, idl_filename, constructors) 184 interface_name, idl_filename, constructors)
187 185
188 186
189 if __name__ == '__main__': 187 if __name__ == '__main__':
190 sys.exit(main()) 188 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698