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

Unified Diff: Source/bindings/core/v8/V8Binding.h

Issue 684763004: bindings: Fixes perf regression by crrev.com/646523004. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added a comment. Created 6 years, 1 month 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: Source/bindings/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index ef09c6aad52ebdb0eda5ffa66ba3225744f52314..0955e08dbcd77d83eddbfe9af3f1c984e5f0552e 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -227,6 +227,29 @@ inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Scrip
v8SetReturnValue(callbackInfo, wrapper);
}
+template<typename CallbackInfo>
+inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Node* impl)
+{
+ // Since EventTarget has [Custom=ToV8] and V8EventTarget.h defines its own
+ // v8SetReturnValue family, which are slow, we need to override them with
+ // optimized versions for Node and its subclasses. Without this overload,
+ // v8SetReturnValueForMainWorld for Node would be very slow.
+ //
+ // class hierarchy:
+ // ScriptWrappable <-- EventTarget <--+-- Node <-- ...
+ // +-- Window
+ // overloads:
+ // v8SetReturnValueForMainWorld(ScriptWrappable*)
+ // Optimized and very fast.
+ // v8SetReturnValueForMainWorld(EventTarget*)
+ // Uses custom toV8 function and slow.
+ // v8SetReturnValueForMainWorld(Node*)
+ // Optimized and very fast.
+ // v8SetReturnValueForMainWorld(Window*)
+ // Uses custom toV8 function and slow.
+ v8SetReturnValueForMainWorld(callbackInfo, ScriptWrappable::fromNode(impl));
+}
+
template<typename CallbackInfo, typename T>
inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<T> impl)
{
« 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