1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/core/v8/V8DOMWrapper.h"
13 #include "bindings/core/v8/WrapperTypeInfo.h"
14 #include "bindings/tests/idls/TestNode.h"
15 #include "bindings/tests/v8/V8Node.h"
16 #include "platform/heap/Handle.h"
22 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
23 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
24 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
25 static TestNode* toNative(v8::Handle<v8::Object> object)
27 return fromInternalPointer(blink::toInternalPointer(object));
29 static TestNode* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
30 static const WrapperTypeInfo wrapperTypeInfo;
31 static void derefObject(ScriptWrappableBase* internalPointer);
32 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
33 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
35 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 0;
36 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0 + 1;
38 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
40 static inline ScriptWrappableBase* toInternalPointer(TestNode* impl)
42 return V8Node::toInternalPointer(impl);
45 static inline TestNode* fromInternalPointer(ScriptWrappableBase* internalPointer)
47 return static_cast<TestNode*>(V8Node::fromInternalPointer(internalPointer));
49 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
50 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
53 friend v8::Handle<v8::Object> wrap(TestNode*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
54 static v8::Handle<v8::Object> createWrapper(PassRefPtrWillBeRawPtr<TestNode>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
57 v8::Handle<v8::Object> wrap(TestNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
59 inline v8::Handle<v8::Value> toV8(TestNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
62 return v8::Null(isolate);
63 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestNode>(impl, isolate);
64 if (!wrapper.IsEmpty())
66 return wrap(impl, creationContext, isolate);
69 template<typename CallbackInfo>
70 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestNode* impl)
72 if (UNLIKELY(!impl)) {
73 v8SetReturnValueNull(callbackInfo);
76 if (DOMDataStore::setReturnValueFromWrapper<V8TestNode>(callbackInfo.GetReturnValue(), impl))
78 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
79 v8SetReturnValue(callbackInfo, wrapper);
82 template<typename CallbackInfo>
83 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestNode* impl)
85 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
86 if (UNLIKELY(!impl)) {
87 v8SetReturnValueNull(callbackInfo);
90 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestNode>(callbackInfo.GetReturnValue(), impl))
92 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
93 v8SetReturnValue(callbackInfo, wrapper);
96 template<class CallbackInfo, class Wrappable>
97 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestNode* impl, Wrappable* wrappable)
99 if (UNLIKELY(!impl)) {
100 v8SetReturnValueNull(callbackInfo);
103 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestNode>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
105 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
106 v8SetReturnValue(callbackInfo, wrapper);
109 inline v8::Handle<v8::Value> toV8(PassRefPtrWillBeRawPtr<TestNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
111 return toV8(impl.get(), creationContext, isolate);
114 template<class CallbackInfo>
115 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestNode> impl)
117 v8SetReturnValue(callbackInfo, impl.get());
120 template<class CallbackInfo>
121 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestNode> impl)
123 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
126 template<class CallbackInfo, class Wrappable>
127 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestNode> impl, Wrappable* wrappable)
129 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
133 #endif // V8TestNode_h