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/TestObject.h"
15 #include "platform/heap/Handle.h"
23 static bool voidMethodImplementedInPrivateScriptMethod(LocalFrame* frame, TestObject* holderImpl);
24 static bool shortMethodImplementedInPrivateScriptMethod(LocalFrame* frame, TestObject* holderImpl, int* result);
25 static bool shortMethodWithShortArgumentImplementedInPrivateScriptMethod(LocalFrame* frame, TestObject* holderImpl, int value, int* result);
26 static bool stringMethodWithStringArgumentImplementedInPrivateScriptMethod(LocalFrame* frame, TestObject* holderImpl, String value, String* result);
27 static bool nodeMethodWithNodeArgumentImplementedInPrivateScriptMethod(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBeRawPtr<Node> value, RefPtrWillBeRawPtr<Node>* result);
28 static bool nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethod(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBeRawPtr<Document> document, PassRefPtrWillBeRawPtr<Node> node, int value1, double value2, String string, RefPtrWillBeRawPtr<Node>* result);
29 static bool methodForPrivateScriptOnlyMethod(LocalFrame* frame, TestObject* holderImpl, int value1, int value2, int* result);
30 static bool readonlyShortAttributeAttributeGetter(LocalFrame* frame, TestObject* holderImpl, int* result);
31 static bool shortAttributeAttributeGetter(LocalFrame* frame, TestObject* holderImpl, int* result);
32 static bool shortAttributeAttributeSetter(LocalFrame* frame, TestObject* holderImpl, int cppValue);
33 static bool stringAttributeAttributeGetter(LocalFrame* frame, TestObject* holderImpl, String* result);
34 static bool stringAttributeAttributeSetter(LocalFrame* frame, TestObject* holderImpl, String cppValue);
35 static bool nodeAttributeAttributeGetter(LocalFrame* frame, TestObject* holderImpl, RefPtrWillBeRawPtr<Node>* result);
36 static bool nodeAttributeAttributeSetter(LocalFrame* frame, TestObject* holderImpl, PassRefPtrWillBeRawPtr<Node> cppValue);
37 static bool attributeForPrivateScriptOnlyAttributeGetter(LocalFrame* frame, TestObject* holderImpl, String* result);
38 static bool attributeForPrivateScriptOnlyAttributeSetter(LocalFrame* frame, TestObject* holderImpl, String cppValue);
41 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
42 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
43 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
44 static TestObject* toNative(v8::Handle<v8::Object> object)
46 return fromInternalPointer(blink::toInternalPointer(object));
48 static TestObject* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
49 static const WrapperTypeInfo wrapperTypeInfo;
50 static void derefObject(ScriptWrappableBase* internalPointer);
51 static void customVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
53 static void conditionalConditionCustomVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
54 #endif // ENABLE(CONDITION)
55 static void customObjectAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
56 static void customObjectAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
57 static void customGetterLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
58 static void customGetterReadonlyObjectAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
59 static void customSetterLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
61 static void customLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
62 #endif // ENABLE(CONDITION)
64 static void customLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
65 #endif // ENABLE(CONDITION)
66 static void customImplementedAsLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
67 static void customImplementedAsLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
68 static void customGetterImplementedAsLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
69 static void customSetterImplementedAsLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
70 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
71 static inline ScriptWrappableBase* toInternalPointer(TestObject* impl)
73 return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
76 static inline TestObject* fromInternalPointer(ScriptWrappableBase* internalPointer)
78 return reinterpret_cast<TestObject*>(static_cast<void*>(internalPointer));
80 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*);
81 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*);
84 friend v8::Handle<v8::Object> wrap(TestObject*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
85 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestObject>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
88 v8::Handle<v8::Object> wrap(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
90 inline v8::Handle<v8::Value> toV8(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
93 return v8::Null(isolate);
94 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObject>(impl, isolate);
95 if (!wrapper.IsEmpty())
97 return wrap(impl, creationContext, isolate);
100 template<typename CallbackInfo>
101 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestObject* impl)
103 if (UNLIKELY(!impl)) {
104 v8SetReturnValueNull(callbackInfo);
107 if (DOMDataStore::setReturnValueFromWrapper<V8TestObject>(callbackInfo.GetReturnValue(), impl))
109 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
110 v8SetReturnValue(callbackInfo, wrapper);
113 template<typename CallbackInfo>
114 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestObject* impl)
116 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
117 if (UNLIKELY(!impl)) {
118 v8SetReturnValueNull(callbackInfo);
121 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObject>(callbackInfo.GetReturnValue(), impl))
123 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
124 v8SetReturnValue(callbackInfo, wrapper);
127 template<class CallbackInfo, class Wrappable>
128 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestObject* impl, Wrappable* wrappable)
130 if (UNLIKELY(!impl)) {
131 v8SetReturnValueNull(callbackInfo);
134 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestObject>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
136 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
137 v8SetReturnValue(callbackInfo, wrapper);
140 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
142 return toV8(impl.get(), creationContext, isolate);
145 template<class CallbackInfo>
146 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
148 v8SetReturnValue(callbackInfo, impl.get());
151 template<class CallbackInfo>
152 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
154 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
157 template<class CallbackInfo, class Wrappable>
158 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl, Wrappable* wrappable)
160 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
164 #endif // V8TestObject_h