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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.cpp

Issue 1494803003: bindings: Improves the speed perf of EventTarget.dispatchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/templates/methods.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp b/third_party/WebKit/Source/bindings/templates/methods.cpp
index c58d89c7afe512e303515e5950aaa1c565c765bb..c9295cdb161dd59f47fef4cb27ac0742c9f17d09 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp
@@ -28,12 +28,27 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{% endif %}
{# Security checks #}
{% if method.is_check_security_for_receiver %}
+ {% if interface_name == 'EventTarget' %}
+ // Performance hack for EventTarget. Checking whether it's a Window or not
+ // prior to the call to BindingSecurity::shouldAllowAccessTo increases 30%
+ // of speed performance on Android Nexus 7 as of Dec 2016. ALWAYS_INLINE
+ // didn't work in this case.
+ if (LocalDOMWindow* window = impl->toDOMWindow()) {
+ if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), window, exceptionState)) {
+ {% if not method.returns_promise %}
+ exceptionState.throwIfNeeded();
+ {% endif %}
+ return;
+ }
+ }
+ {% else %}{# interface_name == 'EventTarget' #}
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
{% if not method.returns_promise %}
exceptionState.throwIfNeeded();
{% endif %}
return;
}
+ {% endif %}{# interface_name == 'EventTarget' #}
{% endif %}
{% if method.is_check_security_for_return_value %}
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698