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

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

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed patch conflict Created 6 years, 2 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 | Annotate | Revision Log
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 * public: 62 * public:
63 'is_callback_interface': bool, callback interface or not 63 'is_callback_interface': bool, callback interface or not
64 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name) 64 'implemented_as': value of [ImplementedAs=...] on interface (C++ class name)
65 65
66 * paths: 66 * paths:
67 'full_path': path to the IDL file, so can lookup an IDL by interface name 67 'full_path': path to the IDL file, so can lookup an IDL by interface name
68 'include_path': path for use in C++ #include directives 68 'include_path': path for use in C++ #include directives
69 'dependencies_full_paths': paths to dependencies (for merging into main) 69 'dependencies_full_paths': paths to dependencies (for merging into main)
70 'dependencies_include_paths': paths for use in C++ #include directives 70 'dependencies_include_paths': paths for use in C++ #include directives
71 'dependencies_other_component_full_paths':
72 paths to dependencies (cannot merge because of other component)
73 'dependencies_other_component_include_paths':
74 paths for use in C++ #include directives because of dependencies in
75 other component
71 76
72 Note that all of these are stable information, unlikely to change without 77 Note that all of these are stable information, unlikely to change without
73 moving or deleting files (hence requiring a full rebuild anyway) or significant 78 moving or deleting files (hence requiring a full rebuild anyway) or significant
74 code changes (for inherited extended attributes). 79 code changes (for inherited extended attributes).
75 80
76 Design doc: http://www.chromium.org/developers/design-documents/idl-build 81 Design doc: http://www.chromium.org/developers/design-documents/idl-build
77 """ 82 """
78 83
79 from collections import defaultdict 84 from collections import defaultdict
80 import cPickle as pickle 85 import cPickle as pickle
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 # Implemented interfaces don't need includes, as this is handled in 266 # Implemented interfaces don't need includes, as this is handled in
262 # the Blink implementation (they are implemented on |impl| itself, 267 # the Blink implementation (they are implemented on |impl| itself,
263 # hence header is included in implementing class). 268 # hence header is included in implementing class).
264 # However, they are needed for legacy implemented interfaces that 269 # However, they are needed for legacy implemented interfaces that
265 # are being treated as partial interfaces, until we remove these. 270 # are being treated as partial interfaces, until we remove these.
266 # http://crbug.com/360435 271 # http://crbug.com/360435
267 implemented_interfaces_include_paths = [] 272 implemented_interfaces_include_paths = []
268 for implemented_interface_info in implemented_interfaces_info: 273 for implemented_interface_info in implemented_interfaces_info:
269 if (implemented_interface_info['is_legacy_treat_as_partial_interface '] and 274 if (implemented_interface_info['is_legacy_treat_as_partial_interface '] and
270 implemented_interface_info['include_path']): 275 implemented_interface_info['include_path']):
271 implemented_interfaces_include_paths.append(implemented_interfac e_info['include_path']) 276 implemented_interfaces_include_paths.append(
277 implemented_interface_info['include_path'])
278
279 dependencies_full_paths = implemented_interfaces_full_paths
280 dependencies_include_paths = implemented_interfaces_include_paths
281 dependencies_other_component_full_paths = []
282 dependencies_other_component_include_paths = []
283
284 component = idl_filename_to_component(interface_info['full_path'])
285 for full_path in partial_interfaces_full_paths:
286 partial_interface_component = idl_filename_to_component(full_path)
287 if component == partial_interface_component:
288 dependencies_full_paths.append(full_path)
289 else:
290 dependencies_other_component_full_paths.append(full_path)
291
292 for include_path in partial_interfaces_include_paths:
293 partial_interface_component = idl_filename_to_component(include_path )
294 if component == partial_interface_component:
295 dependencies_include_paths.append(include_path)
296 else:
297 dependencies_other_component_include_paths.append(include_path)
272 298
273 interface_info.update({ 299 interface_info.update({
274 'dependencies_full_paths': (partial_interfaces_full_paths + 300 'dependencies_full_paths': dependencies_full_paths,
275 implemented_interfaces_full_paths), 301 'dependencies_include_paths': dependencies_include_paths,
276 'dependencies_include_paths': (partial_interfaces_include_paths + 302 'dependencies_other_component_full_paths':
277 implemented_interfaces_include_paths) , 303 dependencies_other_component_full_paths,
304 'dependencies_other_component_include_paths':
305 dependencies_other_component_include_paths,
278 }) 306 })
279 307
280 # Clean up temporary private information 308 # Clean up temporary private information
281 for interface_info in interfaces_info.itervalues(): 309 for interface_info in interfaces_info.itervalues():
282 del interface_info['extended_attributes'] 310 del interface_info['extended_attributes']
283 del interface_info['is_legacy_treat_as_partial_interface'] 311 del interface_info['is_legacy_treat_as_partial_interface']
284 del interface_info['parent'] 312 del interface_info['parent']
285 313
286 # Compute global_type_info to interfaces_info so that idl_compiler does 314 # Compute global_type_info to interfaces_info so that idl_compiler does
287 # not need to always calculate the info in __init__. 315 # not need to always calculate the info in __init__.
288 compute_global_type_info() 316 compute_global_type_info()
289 317
290 318
291 ################################################################################ 319 ################################################################################
292 320
293 def main(): 321 def main():
294 options, args = parse_options() 322 options, args = parse_options()
295 # args = Input1, Input2, ..., Output 323 # args = Input1, Input2, ..., Output
296 interfaces_info_filename = args.pop() 324 interfaces_info_filename = args.pop()
297 info_individuals = read_pickle_files(args) 325 info_individuals = read_pickle_files(args)
298 326
299 compute_interfaces_info_overall(info_individuals) 327 compute_interfaces_info_overall(info_individuals)
300 write_pickle_file(interfaces_info_filename, 328 write_pickle_file(interfaces_info_filename,
301 interfaces_info, 329 interfaces_info,
302 options.write_file_only_if_changed) 330 options.write_file_only_if_changed)
303 331
304 332
305 if __name__ == '__main__': 333 if __name__ == '__main__':
306 sys.exit(main()) 334 sys.exit(main())
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.py ('k') | Source/bindings/scripts/generate_init_partial_interfaces.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698