Chromium Code Reviews| 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) |
| { |