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

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

Issue 315003004: IDL build: Split global object computation into core and modules (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move modules_global_objects to core/generated to eliminate circular dependency of GYP files Created 6 years, 6 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
« no previous file with comments | « Source/bindings/scripts/compute_global_objects.py ('k') | 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 code changes (for inherited extended attributes). 74 code changes (for inherited extended attributes).
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 cPickle as pickle 80 import cPickle as pickle
81 import optparse 81 import optparse
82 import sys 82 import sys
83 83
84 from utilities import write_pickle_file 84 from utilities import read_pickle_files, write_pickle_file
85 85
86 INHERITED_EXTENDED_ATTRIBUTES = set([ 86 INHERITED_EXTENDED_ATTRIBUTES = set([
87 'ActiveDOMObject', 87 'ActiveDOMObject',
88 'DependentLifetime', 88 'DependentLifetime',
89 'GarbageCollected', 89 'GarbageCollected',
90 'WillBeGarbageCollected', 90 'WillBeGarbageCollected',
91 ]) 91 ])
92 92
93 # Main variable (filled in and exported) 93 # Main variable (filled in and exported)
94 interfaces_info = {} 94 interfaces_info = {}
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 continue 130 continue
131 existing_value = existing[key] 131 existing_value = existing[key]
132 for inner_key, inner_value in value.iteritems(): 132 for inner_key, inner_value in value.iteritems():
133 existing_value[inner_key].extend(inner_value) 133 existing_value[inner_key].extend(inner_value)
134 134
135 135
136 ################################################################################ 136 ################################################################################
137 # Computations 137 # Computations
138 ################################################################################ 138 ################################################################################
139 139
140 def read_interfaces_info(interfaces_info_individual_filenames):
141 # Read in individual info from files
142 for interfaces_info_individual_filename in interfaces_info_individual_filena mes:
143 with open(interfaces_info_individual_filename) as interfaces_info_indivi dual_file:
144 yield pickle.load(interfaces_info_individual_file)
145
146
147 def compute_inheritance_info(interface_name): 140 def compute_inheritance_info(interface_name):
148 """Compute inheritance information, namely ancestors and inherited extended attributes.""" 141 """Compute inheritance information, namely ancestors and inherited extended attributes."""
149 def generate_ancestors(interface_name): 142 def generate_ancestors(interface_name):
150 while interface_name in parent_interfaces: 143 while interface_name in parent_interfaces:
151 interface_name = parent_interfaces[interface_name] 144 interface_name = parent_interfaces[interface_name]
152 yield interface_name 145 yield interface_name
153 146
154 ancestors = list(generate_ancestors(interface_name)) 147 ancestors = list(generate_ancestors(interface_name))
155 inherited_extended_attributes = inherited_extended_attributes_by_interface[i nterface_name] 148 inherited_extended_attributes = inherited_extended_attributes_by_interface[i nterface_name]
156 for ancestor in ancestors: 149 for ancestor in ancestors:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 del interface_info['is_legacy_treat_as_partial_interface'] 245 del interface_info['is_legacy_treat_as_partial_interface']
253 del interface_info['parent'] 246 del interface_info['parent']
254 247
255 248
256 ################################################################################ 249 ################################################################################
257 250
258 def main(): 251 def main():
259 options, args = parse_options() 252 options, args = parse_options()
260 # args = Input1, Input2, ..., Output 253 # args = Input1, Input2, ..., Output
261 interfaces_info_filename = args.pop() 254 interfaces_info_filename = args.pop()
262 info_individuals = read_interfaces_info(args) 255 info_individuals = read_pickle_files(args)
263 256
264 compute_interfaces_info_overall(info_individuals) 257 compute_interfaces_info_overall(info_individuals)
265 write_pickle_file(interfaces_info_filename, 258 write_pickle_file(interfaces_info_filename,
266 interfaces_info, 259 interfaces_info,
267 options.write_file_only_if_changed) 260 options.write_file_only_if_changed)
268 261
269 262
270 if __name__ == '__main__': 263 if __name__ == '__main__':
271 sys.exit(main()) 264 sys.exit(main())
OLDNEW
« no previous file with comments | « Source/bindings/scripts/compute_global_objects.py ('k') | Source/bindings/scripts/utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698