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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl

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
Index: third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl
index 9e2b38bbc552360197fd59c54620dcc460e0855b..f893780fa8857df0941555c4fc8404c87faa838b 100644
--- a/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/EventFactory.cpp.tmpl
@@ -8,19 +8,24 @@
{% endif %}
#include "{{namespace}}{{suffix}}Headers.h"
+#include "core/frame/UseCounter.h"
#include "platform/RuntimeEnabledFeatures.h"
namespace blink {
-PassRefPtrWillBeRawPtr<{{namespace}}> {{namespace}}{{suffix}}Factory::create(ExecutionContext*, const String& type)
+PassRefPtrWillBeRawPtr<{{namespace}}> {{namespace}}{{suffix}}Factory::create(ExecutionContext* executionContext, const String& type)
{
{% for event in events %}
{% if event|script_name|case_insensitive_matching %}
- if (equalIgnoringCase(type, "{{event|script_name}}"){% if event.RuntimeEnabled %} && RuntimeEnabledFeatures::{{event.RuntimeEnabled|lower_first}}(){% endif %})
+ if (equalIgnoringCase(type, "{{event|script_name}}"){% if event.RuntimeEnabled %} && RuntimeEnabledFeatures::{{event.RuntimeEnabled|lower_first}}(){% endif %}) {
{% else %}
- if (type == "{{event|script_name}}"{% if event.RuntimeEnabled %} && RuntimeEnabledFeatures::{{event.RuntimeEnabled|lower_first}}(){% endif %})
+ if (type == "{{event|script_name}}"{% if event.RuntimeEnabled %} && RuntimeEnabledFeatures::{{event.RuntimeEnabled|lower_first}}(){% endif %}) {
{% endif %}
+ {% if not event|script_name|candidate_whitelist %}
+ UseCounter::count(executionContext, UseCounter::{{event|script_name|measure_name}});
+ {% endif %}
return {{event|cpp_name}}::create();
+ }
{% endfor %}
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698