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

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: 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
Index: Source/bindings/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index 4afb2e0fe547e01243d558db396bfd90e72e60a6..ba87518478e97a0b3915e205463272f090f4fc03 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 and WorkerGlobalScope
haraken 2015/04/24 11:57:38 and EventTarget
Yuki 2015/04/27 12:42:34 Done.
+
+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 and WorkerGlobalScope
haraken 2015/04/24 11:57:38 and EventTarget
Yuki 2015/04/27 12:42:34 Done.
+
+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 and WorkerGlobalScope
haraken 2015/04/24 11:57:38 and EventTarget
Yuki 2015/04/27 12:42:34 Done.
+
+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)
{

Powered by Google App Engine
This is Rietveld 408576698