OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 constructor_list = generate_constructor_attribute_list(interface
_name, extended_attributes) | 159 constructor_list = generate_constructor_attribute_list(interface
_name, extended_attributes) |
160 if global_context != "WorkerOnly": | 160 if global_context != "WorkerOnly": |
161 window_constructor_attributes_list.extend(constructor_list) | 161 window_constructor_attributes_list.extend(constructor_list) |
162 if global_context != "WindowOnly": | 162 if global_context != "WindowOnly": |
163 workercontext_constructor_attributes_list.extend(constructor
_list) | 163 workercontext_constructor_attributes_list.extend(constructor
_list) |
164 interface_name_to_idl_file[interface_name] = full_path | 164 interface_name_to_idl_file[interface_name] = full_path |
165 idl_file_to_interface_name[full_path] = interface_name | 165 idl_file_to_interface_name[full_path] = interface_name |
166 supplementals[full_path] = [] | 166 supplementals[full_path] = [] |
167 | 167 |
168 # Generate Global constructors | 168 # Generate Global constructors |
169 generate_global_constructors_partial_interface("DOMWindow", window_construct
ors_filename, window_constructor_attributes_list) | 169 generate_global_constructors_partial_interface("Window", window_constructors
_filename, window_constructor_attributes_list) |
170 if 'DOMWindow' in interface_name_to_idl_file: | 170 if 'Window' in interface_name_to_idl_file: |
171 supplemental_dependencies[window_constructors_filename] = 'DOMWindow' | 171 supplemental_dependencies[window_constructors_filename] = 'Window' |
172 generate_global_constructors_partial_interface("WorkerContext", workercontex
t_constructors_filename, workercontext_constructor_attributes_list) | 172 generate_global_constructors_partial_interface("WorkerContext", workercontex
t_constructors_filename, workercontext_constructor_attributes_list) |
173 if 'WorkerContext' in interface_name_to_idl_file: | 173 if 'WorkerContext' in interface_name_to_idl_file: |
174 supplemental_dependencies[workercontext_constructors_filename] = 'Worker
Context' | 174 supplemental_dependencies[workercontext_constructors_filename] = 'Worker
Context' |
175 | 175 |
176 # Resolve partial interfaces dependencies | 176 # Resolve partial interfaces dependencies |
177 for idl_file, base_file in supplemental_dependencies.iteritems(): | 177 for idl_file, base_file in supplemental_dependencies.iteritems(): |
178 target_idl_file = interface_name_to_idl_file[base_file] | 178 target_idl_file = interface_name_to_idl_file[base_file] |
179 supplementals[target_idl_file].append(idl_file) | 179 supplementals[target_idl_file].append(idl_file) |
180 if idl_file in supplementals: | 180 if idl_file in supplementals: |
181 # Should never occur. Might be needed in corner cases. | 181 # Should never occur. Might be needed in corner cases. |
182 del supplementals[idl_file] | 182 del supplementals[idl_file] |
183 return supplementals | 183 return supplementals |
184 | 184 |
185 | 185 |
186 def write_dependency_file(filename, supplementals, only_if_changed=False): | 186 def write_dependency_file(filename, supplementals, only_if_changed=False): |
187 """Outputs the dependency file. | 187 """Outputs the dependency file. |
188 | 188 |
189 The format of a supplemental dependency file: | 189 The format of a supplemental dependency file: |
190 | 190 |
191 DOMWindow.idl P.idl Q.idl R.idl | 191 Window.idl P.idl Q.idl R.idl |
192 Document.idl S.idl | 192 Document.idl S.idl |
193 Event.idl | 193 Event.idl |
194 ... | 194 ... |
195 | 195 |
196 The above indicates that: | 196 The above indicates that: |
197 DOMWindow.idl is supplemented by P.idl, Q.idl and R.idl, | 197 Window.idl is supplemented by P.idl, Q.idl and R.idl, |
198 Document.idl is supplemented by S.idl, and | 198 Document.idl is supplemented by S.idl, and |
199 Event.idl is supplemented by no IDLs. | 199 Event.idl is supplemented by no IDLs. |
200 | 200 |
201 An IDL that supplements another IDL (e.g. P.idl) does not have its own | 201 An IDL that supplements another IDL (e.g. P.idl) does not have its own |
202 lines in the dependency file. | 202 lines in the dependency file. |
203 """ | 203 """ |
204 new_lines = [] | 204 new_lines = [] |
205 for idl_file, supplemental_files in sorted(supplementals.iteritems()): | 205 for idl_file, supplemental_files in sorted(supplementals.iteritems()): |
206 new_lines.append('%s %s\n' % (idl_file, ' '.join(supplemental_files))) | 206 new_lines.append('%s %s\n' % (idl_file, ' '.join(supplemental_files))) |
207 if only_if_changed and os.path.isfile(filename): | 207 if only_if_changed and os.path.isfile(filename): |
(...skipping 10 matching lines...) Expand all Loading... |
218 idl_files = [] | 218 idl_files = [] |
219 with open(options.idl_files_list) as idl_files_list_file: | 219 with open(options.idl_files_list) as idl_files_list_file: |
220 for line in idl_files_list_file: | 220 for line in idl_files_list_file: |
221 idl_files.append(string.rstrip(line, '\n')) | 221 idl_files.append(string.rstrip(line, '\n')) |
222 resolved_supplementals = parse_idl_files(idl_files, options.window_construct
ors_file, options.workercontext_constructors_file) | 222 resolved_supplementals = parse_idl_files(idl_files, options.window_construct
ors_file, options.workercontext_constructors_file) |
223 write_dependency_file(options.supplemental_dependency_file, resolved_supplem
entals, only_if_changed=options.write_file_only_if_changed) | 223 write_dependency_file(options.supplemental_dependency_file, resolved_supplem
entals, only_if_changed=options.write_file_only_if_changed) |
224 | 224 |
225 | 225 |
226 if __name__ == '__main__': | 226 if __name__ == '__main__': |
227 main() | 227 main() |
OLD | NEW |