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

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

Issue 270573005: Move modules-dependent IDL statements out of core by supporting 'implements' in RHS interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed review comments. Created 6 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
« no previous file with comments | « no previous file | Source/bindings/scripts/utilities.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (C) 2013 Google Inc. All rights reserved. 3 # Copyright (C) 2013 Google Inc. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 Design doc: http://www.chromium.org/developers/design-documents/idl-build 76 Design doc: http://www.chromium.org/developers/design-documents/idl-build
77 """ 77 """
78 78
79 from collections import defaultdict 79 from collections import defaultdict
80 import optparse 80 import optparse
81 import os 81 import os
82 import posixpath 82 import posixpath
83 import sys 83 import sys
84 84
85 from utilities import get_file_contents, write_pickle_file, get_interface_extend ed_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_na me_from_idl, get_implemented_interfaces_from_idl, get_parent_interface, get_put_ forward_interfaces_from_idl 85 from utilities import get_file_contents, write_pickle_file, get_interface_extend ed_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_na me_from_idl, get_right_or_left_interfaces_of_implements_from_idl, get_parent_int erface, get_put_forward_interfaces_from_idl
86 86
87 module_path = os.path.dirname(__file__) 87 module_path = os.path.dirname(__file__)
88 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) 88 source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
89 89
90 INHERITED_EXTENDED_ATTRIBUTES = set([ 90 INHERITED_EXTENDED_ATTRIBUTES = set([
91 'ActiveDOMObject', 91 'ActiveDOMObject',
92 'DependentLifetime', 92 'DependentLifetime',
93 'GarbageCollected', 93 'GarbageCollected',
94 'WillBeGarbageCollected', 94 'WillBeGarbageCollected',
95 ]) 95 ])
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 this_include_path = include_path(idl_filename, implemented_as) 165 this_include_path = include_path(idl_filename, implemented_as)
166 166
167 # Handle partial interfaces 167 # Handle partial interfaces
168 partial_interface_name = get_partial_interface_name_from_idl(idl_file_conten ts) 168 partial_interface_name = get_partial_interface_name_from_idl(idl_file_conten ts)
169 if partial_interface_name: 169 if partial_interface_name:
170 add_paths_to_partials_dict(partial_interface_name, full_path, this_inclu de_path) 170 add_paths_to_partials_dict(partial_interface_name, full_path, this_inclu de_path)
171 return 171 return
172 172
173 # If not a partial interface, the basename is the interface name 173 # If not a partial interface, the basename is the interface name
174 interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) 174 interface_name, _ = os.path.splitext(os.path.basename(idl_filename))
175 175
Inactive 2014/05/07 21:10:09 how about something like: implements_statements =
c.shu 2014/05/07 21:42:00 Done.
176 interfaces_info[interface_name] = { 176 interfaces_info[interface_name] = {
177 'full_path': full_path, 177 'full_path': full_path,
178 'implemented_as': implemented_as, 178 'implemented_as': implemented_as,
179 'implements_interfaces': get_implemented_interfaces_from_idl(idl_file_co ntents, interface_name), 179 'implements_interfaces': get_right_or_left_interfaces_of_implements_from _idl(idl_file_contents, interface_name, True),
Inactive 2014/05/07 21:10:09 [v[1] for v in implements_statements]
c.shu 2014/05/07 21:42:00 Done.
180 'include_path': this_include_path, 180 'include_path': this_include_path,
181 # FIXME: temporary private field, while removing old treatement of 181 # FIXME: temporary private field, while removing old treatement of
182 # 'implements': http://crbug.com/360435 182 # 'implements': http://crbug.com/360435
183 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface' in extended_attributes, 183 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface' in extended_attributes,
184 'is_callback_interface': is_callback_interface_from_idl(idl_file_content s), 184 'is_callback_interface': is_callback_interface_from_idl(idl_file_content s),
185 # Interfaces that are referenced (used as types) and that we introspect 185 # Interfaces that are referenced (used as types) and that we introspect
186 # during code generation (beyond interface-level data ([ImplementedAs], 186 # during code generation (beyond interface-level data ([ImplementedAs],
187 # is_callback_interface, ancestors, and inherited extended attributes): 187 # is_callback_interface, ancestors, and inherited extended attributes):
188 # deep dependencies. 188 # deep dependencies.
189 # These cause rebuilds of referrers, due to the dependency, so these 189 # These cause rebuilds of referrers, due to the dependency, so these
190 # should be minimized; currently only targets of [PutForwards]. 190 # should be minimized; currently only targets of [PutForwards].
191 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co ntents), 191 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_co ntents),
192 } 192 }
193 193
194 left_implements_interfaces = get_right_or_left_interfaces_of_implements_from _idl(idl_file_contents, interface_name, False)
Inactive 2014/05/07 21:10:09 Gosh, terribly long function name and an obscure b
c.shu 2014/05/07 21:42:00 Done.
195 for left_interface_name in left_implements_interfaces:
196 interface_info = interfaces_info[left_interface_name]
197 interface_info['implements_interfaces'].append(interface_name)
198
194 # Record inheritance information 199 # Record inheritance information
195 inherited_extended_attributes_by_interface[interface_name] = dict( 200 inherited_extended_attributes_by_interface[interface_name] = dict(
196 (key, value) 201 (key, value)
197 for key, value in extended_attributes.iteritems() 202 for key, value in extended_attributes.iteritems()
198 if key in INHERITED_EXTENDED_ATTRIBUTES) 203 if key in INHERITED_EXTENDED_ATTRIBUTES)
199 parent = get_parent_interface(idl_file_contents) 204 parent = get_parent_interface(idl_file_contents)
200 if parent: 205 if parent:
201 parent_interfaces[interface_name] = parent 206 parent_interfaces[interface_name] = parent
202 207
203 208
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 idl_files.extend(args) 302 idl_files.extend(args)
298 303
299 compute_interfaces_info(idl_files) 304 compute_interfaces_info(idl_files)
300 write_pickle_file(options.interfaces_info_file, 305 write_pickle_file(options.interfaces_info_file,
301 interfaces_info, 306 interfaces_info,
302 options.write_file_only_if_changed) 307 options.write_file_only_if_changed)
303 308
304 309
305 if __name__ == '__main__': 310 if __name__ == '__main__':
306 sys.exit(main()) 311 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698