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/core/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);
39 static bool enumForPrivateScriptAttributeGetter(LocalFrame* frame, TestObject* holderImpl, String* result);
40 static bool enumForPrivateScriptAttributeSetter(LocalFrame* frame, TestObject* holderImpl, String cppValue);
43 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
44 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
45 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
46 static TestObject* toImpl(v8::Handle<v8::Object> object)
48 return toImpl(blink::toScriptWrappableBase(object));
50 static TestObject* toImplWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
51 static const WrapperTypeInfo wrapperTypeInfo;
52 static void refObject(ScriptWrappableBase* internalPointer);
53 static void derefObject(ScriptWrappableBase* internalPointer);
54 static WrapperPersistentNode* createPersistentHandle(ScriptWrappableBase* internalPointer);
55 static void customVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
57 static void conditionalConditionCustomVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
58 #endif // ENABLE(CONDITION)
59 static void customObjectAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
60 static void customObjectAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
61 static void customGetterLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
62 static void customGetterReadonlyObjectAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
63 static void customSetterLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
65 static void customLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
66 #endif // ENABLE(CONDITION)
68 static void customLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
69 #endif // ENABLE(CONDITION)
70 static void customImplementedAsLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
71 static void customImplementedAsLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
72 static void customGetterImplementedAsLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
73 static void customSetterImplementedAsLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
74 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
75 static inline ScriptWrappableBase* toScriptWrappableBase(TestObject* impl)
77 return impl->toScriptWrappableBase();
80 static inline TestObject* toImpl(ScriptWrappableBase* internalPointer)
82 return internalPointer->toImpl<TestObject>();
84 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*);
85 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*);
90 inline v8::Handle<v8::Object> wrap(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
92 return impl->wrap(creationContext, isolate);
95 inline v8::Handle<v8::Value> toV8(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
98 return v8::Null(isolate);
99 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObject>(impl, isolate);
100 if (!wrapper.IsEmpty())
103 return impl->wrap(creationContext, isolate);
106 template<typename CallbackInfo>
107 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestObject* impl)
109 if (UNLIKELY(!impl)) {
110 v8SetReturnValueNull(callbackInfo);
113 if (DOMDataStore::setReturnValueFromWrapper<V8TestObject>(callbackInfo.GetReturnValue(), impl))
115 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
116 v8SetReturnValue(callbackInfo, wrapper);
119 template<typename CallbackInfo>
120 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestObject* impl)
122 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
123 if (UNLIKELY(!impl)) {
124 v8SetReturnValueNull(callbackInfo);
127 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObject>(callbackInfo.GetReturnValue(), impl))
129 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
130 v8SetReturnValue(callbackInfo, wrapper);
133 template<class CallbackInfo, class Wrappable>
134 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestObject* impl, Wrappable* wrappable)
136 if (UNLIKELY(!impl)) {
137 v8SetReturnValueNull(callbackInfo);
140 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestObject>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
142 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
143 v8SetReturnValue(callbackInfo, wrapper);
146 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
148 return toV8(impl.get(), creationContext, isolate);
151 template<class CallbackInfo>
152 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
154 v8SetReturnValue(callbackInfo, impl.get());
157 template<class CallbackInfo>
158 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
160 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
163 template<class CallbackInfo, class Wrappable>
164 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl, Wrappable* wrappable)
166 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
170 #endif // V8TestObject_h