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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_event_factory.py

Issue 2755313002: Fix issue 701381. (Closed)
Patch Set: Rebase and reupload the patch Created 3 years, 8 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (C) 2013 Google Inc. All rights reserved. 2 # Copyright (C) 2013 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 or name == 'Event' 56 or name == 'Event'
57 or name == 'Events' 57 or name == 'Events'
58 or name.startswith('UIEvent') 58 or name.startswith('UIEvent')
59 or name.startswith('CustomEvent') 59 or name.startswith('CustomEvent')
60 or name == 'KeyboardEvent' 60 or name == 'KeyboardEvent'
61 or name == 'MessageEvent' 61 or name == 'MessageEvent'
62 or name.startswith('MouseEvent') 62 or name.startswith('MouseEvent')
63 or name == 'TouchEvent') 63 or name == 'TouchEvent')
64 64
65 65
66 # All events on the following whitelist are matched case-sensitively 66 # All events on the following whitelist are matched case-insensitively
67 # in createEvent and are measured using UseCounter. 67 # in createEvent and are measured using UseCounter.
68 # 68 #
69 # TODO(foolip): All events on this list should either be added to the spec and 69 # TODO(foolip): All events on this list should either be added to the spec and
70 # moved to the above whitelist (causing them to be matched case-insensitively) 70 # moved to the above whitelist (causing them to be matched case-insensitively)
71 # or be deprecated/removed. https://crbug.com/569690 71 # or be deprecated/removed. https://crbug.com/569690
72 def create_event_legacy_whitelist(name): 72 def create_event_measure_whitelist(name):
73 return (name == 'AnimationEvent' 73 return (name == 'AnimationEvent'
74 or name == 'BeforeUnloadEvent' 74 or name == 'BeforeUnloadEvent'
75 or name == 'CloseEvent' 75 or name == 'CloseEvent'
76 or name == 'CompositionEvent' 76 or name == 'CompositionEvent'
77 or name == 'DeviceMotionEvent' 77 or name == 'DeviceMotionEvent'
78 or name == 'DeviceOrientationEvent' 78 or name == 'DeviceOrientationEvent'
79 or name == 'DragEvent' 79 or name == 'DragEvent'
80 or name == 'ErrorEvent' 80 or name == 'ErrorEvent'
81 or name == 'FocusEvent' 81 or name == 'FocusEvent'
82 or name == 'HashChangeEvent' 82 or name == 'HashChangeEvent'
(...skipping 27 matching lines...) Expand all
110 default_metadata = { 110 default_metadata = {
111 'export': '', 111 'export': '',
112 'namespace': '', 112 'namespace': '',
113 'suffix': '', 113 'suffix': '',
114 } 114 }
115 filters = { 115 filters = {
116 'cpp_name': name_utilities.cpp_name, 116 'cpp_name': name_utilities.cpp_name,
117 'lower_first': name_utilities.lower_first, 117 'lower_first': name_utilities.lower_first,
118 'script_name': name_utilities.script_name, 118 'script_name': name_utilities.script_name,
119 'create_event_whitelist': create_event_whitelist, 119 'create_event_whitelist': create_event_whitelist,
120 'create_event_legacy_whitelist': create_event_legacy_whitelist, 120 'create_event_measure_whitelist': create_event_measure_whitelist,
121 'measure_name': measure_name, 121 'measure_name': measure_name,
122 } 122 }
123 123
124 def __init__(self, json5_file_path): 124 def __init__(self, json5_file_path):
125 super(EventFactoryWriter, self).__init__(json5_file_path) 125 super(EventFactoryWriter, self).__init__(json5_file_path)
126 self.namespace = self.json5_file.metadata['namespace'].strip('"') 126 self.namespace = self.json5_file.metadata['namespace'].strip('"')
127 self.suffix = self.json5_file.metadata['suffix'].strip('"') 127 self.suffix = self.json5_file.metadata['suffix'].strip('"')
128 self._outputs = {(self.namespace + self.suffix + "Headers.h"): self.gene rate_headers_header, 128 self._outputs = {(self.namespace + self.suffix + "Headers.h"): self.gene rate_headers_header,
129 (self.namespace + self.suffix + ".cpp"): self.generate_ implementation, 129 (self.namespace + self.suffix + ".cpp"): self.generate_ implementation,
130 } 130 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 def generate_implementation(self): 177 def generate_implementation(self):
178 return { 178 return {
179 'namespace': self.namespace, 179 'namespace': self.namespace,
180 'suffix': self.suffix, 180 'suffix': self.suffix,
181 'events': self.json5_file.name_dictionaries, 181 'events': self.json5_file.name_dictionaries,
182 } 182 }
183 183
184 184
185 if __name__ == "__main__": 185 if __name__ == "__main__":
186 json5_generator.Maker(EventFactoryWriter).main() 186 json5_generator.Maker(EventFactoryWriter).main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698