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

Unified Diff: third_party/WebKit/Source/build/scripts/make_event_factory.py

Issue 1673243002: Count document.createEvent() usage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-executioncontext-to
Patch Set: Update histograms.xml Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/build/scripts/make_event_factory.py
diff --git a/third_party/WebKit/Source/build/scripts/make_event_factory.py b/third_party/WebKit/Source/build/scripts/make_event_factory.py
index aa87658f566846a906dffccc7e3b842533af0a4a..1f280fe05ae3fa981a62ba66feff7dbc14b8dfab 100755
--- a/third_party/WebKit/Source/build/scripts/make_event_factory.py
+++ b/third_party/WebKit/Source/build/scripts/make_event_factory.py
@@ -59,6 +59,41 @@ def case_insensitive_matching(name):
or name == 'TouchEvent')
+# All events _not_ on the following whitelist are being measured in
philipj_slow 2016/02/11 14:40:28 I like this approach! But can you reduce the list
+# createEvent. The plan is to limit createEvent to just a few selected
+# events necessary for legacy content according to the specification:
+#
+# https://dom.spec.whatwg.org/#dom-document-createevent
+#
+# The criteria for the current whitelist, unless otherwise noted, is
+# to have a corresponding init*Event() function, or being an alias for
+# an event that has a corresponding init*Event(). It isn't a full
+# match with the spec yet.
+def candidate_whitelist(name):
+ return (name == 'CustomEvent'
+ or name == 'CompositionEvent'
+ or name == 'DeviceMotionEvent'
+ or name == 'DeviceOrientationEvent'
+ or name == 'Event'
+ or name == 'Events'
+ or name == 'HTMLEvents'
+ or name == 'KeyboardEvent'
+ or name == 'KeyboardEvents'
+ or name == 'MessageEvent'
+ or name == 'MouseEvent'
+ or name == 'MutationEvent'
+ or name == 'OrientationEvent'
+ or name == 'SVGEvents'
+ or name == 'SVGZoomEvent' # Will be deprecated instead.
+ or name == 'StorageEvent'
+ or name == 'TextEvent'
+ or name == 'TouchEvent'
+ or name == 'UIEvent')
+
+
+def measure_name(name):
+ return 'DocumentCreateEvent' + name
+
class EventFactoryWriter(in_generator.Writer):
defaults = {
'ImplementedAs': None,
@@ -74,6 +109,8 @@ class EventFactoryWriter(in_generator.Writer):
'lower_first': name_utilities.lower_first,
'case_insensitive_matching': case_insensitive_matching,
'script_name': name_utilities.script_name,
+ 'candidate_whitelist': candidate_whitelist,
+ 'measure_name': measure_name,
}
def __init__(self, in_file_path):
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698