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

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

Issue 1083003004: bindings: Moves toV8 and v8SetReturnValue out to ToV8.h and V8Binding.h. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed a review comment. Created 5 years, 8 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 | « Source/bindings/core/v8/ToV8.cpp ('k') | Source/bindings/core/v8/custom/V8EventTargetCustom.cpp » ('j') | 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 f7fc1ee20efe04754f218d88ef572e21aa3ae3b1..a7785fc8fe0ea3a063b19dfa1a48121503f536af 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -55,12 +55,13 @@ namespace blink {
class DOMWindow;
class EventListener;
class EventTarget;
-class ExecutionContext;
class ExceptionState;
+class ExecutionContext;
class Frame;
class LocalDOMWindow;
class LocalFrame;
class NodeFilter;
+class WorkerGlobalScope;
class XPathNSResolver;
template <typename T>
@@ -216,6 +217,26 @@ inline void v8SetReturnValue(const CallbackInfo& callbackInfo, Node* impl)
v8SetReturnValue(callbackInfo, wrapper);
}
+// Special versions for DOMWindow, WorkerGlobalScope and EventTarget
+
+template<typename CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DOMWindow* impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template<typename CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, EventTarget* impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template<typename CallbackInfo>
+inline void v8SetReturnValue(const CallbackInfo& callbackInfo, WorkerGlobalScope* impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
template<typename CallbackInfo, typename T>
inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<T> impl)
{
@@ -245,10 +266,11 @@ inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Scrip
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.
+ // Since EventTarget has a special version of 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 <-- ...
@@ -265,6 +287,26 @@ inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Node*
v8SetReturnValueForMainWorld(callbackInfo, ScriptWrappable::fromNode(impl));
}
+// Special versions for DOMWindow, WorkerGlobalScope and EventTarget
+
+template<typename CallbackInfo>
+inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, DOMWindow* impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template<typename CallbackInfo>
+inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, EventTarget* impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template<typename CallbackInfo>
+inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, WorkerGlobalScope* impl)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
template<typename CallbackInfo, typename T>
inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<T> impl)
{
@@ -303,6 +345,26 @@ inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, Node* impl, c
v8SetReturnValue(callbackInfo, wrapper);
}
+// Special versions for DOMWindow, WorkerGlobalScope and EventTarget
+
+template<typename CallbackInfo>
+inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, DOMWindow* impl, const ScriptWrappable*)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template<typename CallbackInfo>
+inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, EventTarget* impl, const ScriptWrappable*)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
+template<typename CallbackInfo>
+inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, WorkerGlobalScope* impl, const ScriptWrappable*)
+{
+ v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
+}
+
template<typename CallbackInfo, typename T, typename Wrappable>
inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<T> impl, const Wrappable* wrappable)
{
« no previous file with comments | « Source/bindings/core/v8/ToV8.cpp ('k') | Source/bindings/core/v8/custom/V8EventTargetCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698