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

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

Issue 183853024: Clean up compute_interfaces_info.py (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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_interfaces_info.py ('k') | no next file » | 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 parser.error('No arguments allowed, but %d given.' % len(args)) 75 parser.error('No arguments allowed, but %d given.' % len(args))
76 return options 76 return options
77 77
78 78
79 def write_event_interfaces_file(interfaces_info, destination_filename, only_if_c hanged): 79 def write_event_interfaces_file(interfaces_info, destination_filename, only_if_c hanged):
80 # Event interfaces are interfaces that inherit from Event, and Event itself 80 # Event interfaces are interfaces that inherit from Event, and Event itself
81 event_interfaces = set( 81 event_interfaces = set(
82 interface_name 82 interface_name
83 for interface_name, interface_info in interfaces_info.iteritems() 83 for interface_name, interface_info in interfaces_info.iteritems()
84 if (interface_name == 'Event' or 84 if (interface_name == 'Event' or
85 ('ancestors' in interface_info and 85 (interface_info['ancestors'] and
86 interface_info['ancestors'][-1] == 'Event'))) 86 interface_info['ancestors'][-1] == 'Event')))
87 87
88 def extended_attribute_string(name, value): 88 def extended_attribute_string(name, value):
89 if name == 'RuntimeEnabled': 89 if name == 'RuntimeEnabled':
90 value += 'Enabled' 90 value += 'Enabled'
91 return name + '=' + value 91 return name + '=' + value
92 92
93 def interface_line(interface_name): 93 def interface_line(interface_name):
94 full_path = interfaces_info[interface_name]['full_path'] 94 full_path = interfaces_info[interface_name]['full_path']
95 95
(...skipping 25 matching lines...) Expand all
121 options = parse_options() 121 options = parse_options()
122 with open(options.interfaces_info_file) as interfaces_info_file: 122 with open(options.interfaces_info_file) as interfaces_info_file:
123 interfaces_info = pickle.load(interfaces_info_file) 123 interfaces_info = pickle.load(interfaces_info_file)
124 write_event_interfaces_file(interfaces_info, 124 write_event_interfaces_file(interfaces_info,
125 options.event_interfaces_file, 125 options.event_interfaces_file,
126 options.write_file_only_if_changed) 126 options.write_file_only_if_changed)
127 127
128 128
129 if __name__ == '__main__': 129 if __name__ == '__main__':
130 sys.exit(main()) 130 sys.exit(main())
OLDNEW
« no previous file with comments | « Source/bindings/scripts/compute_interfaces_info.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698