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

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: Leave histograms.xml for later to avoid having to re-enumerate everything again. 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..7a9d9c28e02cf12d0c26a3ef4abef78dc00650e2 100755
--- a/third_party/WebKit/Source/build/scripts/make_event_factory.py
+++ b/third_party/WebKit/Source/build/scripts/make_event_factory.py
@@ -47,6 +47,11 @@ HEADER_TEMPLATE = """%(license)s
"""
+# The list is a close match to:
+#
+# https://dom.spec.whatwg.org/#dom-document-createevent
+#
+# with the exepction for |keyevents| not present in Blink.
philipj_slow 2016/02/13 14:29:58 https://github.com/whatwg/dom/issues/148
def case_insensitive_matching(name):
return (name == ('HTMLEvents')
or name == 'Event'
@@ -59,6 +64,21 @@ def case_insensitive_matching(name):
or name == 'TouchEvent')
+# All events not on the following whitelist are being measured in
+# createEvent. The plan is to limit createEvent to just a few selected
+# events necessary for legacy content in accordance with the
+# specification:
+#
+# https://dom.spec.whatwg.org/#dom-document-createevent
+def candidate_whitelist(name):
+ return (case_insensitive_matching(name)
+ or name == 'SVGZoomEvent' # Will be deprecated instead.
+ or name == 'SVGZoomEvents') # Will be deprecated instead.
+
+
+def measure_name(name):
+ return 'DocumentCreateEvent' + name
+
class EventFactoryWriter(in_generator.Writer):
defaults = {
'ImplementedAs': None,
@@ -74,6 +94,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