Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestObject.h
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.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #ifndef V8TestObject_h
8 #define V8TestObject_h
9
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"
16
17 namespace blink {
18
19 class V8TestObject {
20 public:
21     class PrivateScript {
22     public:
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);
41     };
42
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)
47     {
48         return toImpl(blink::toScriptWrappableBase(object));
49     }
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>&);
56 #if ENABLE(CONDITION)
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>&);
64 #if ENABLE(CONDITION)
65     static void customLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
66 #endif // ENABLE(CONDITION)
67 #if 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)
76     {
77         return impl->toScriptWrappableBase();
78     }
79
80     static inline TestObject* toImpl(ScriptWrappableBase* internalPointer)
81     {
82         return internalPointer->toImpl<TestObject>();
83     }
84     static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*);
85     static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*);
86
87 private:
88 };
89
90 inline v8::Handle<v8::Object> wrap(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
91 {
92     return impl->wrap(creationContext, isolate);
93 }
94
95 inline v8::Handle<v8::Value> toV8(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
96 {
97     if (UNLIKELY(!impl))
98         return v8::Null(isolate);
99     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObject>(impl, isolate);
100     if (!wrapper.IsEmpty())
101         return wrapper;
102
103     return impl->wrap(creationContext, isolate);
104 }
105
106 template<typename CallbackInfo>
107 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestObject* impl)
108 {
109     if (UNLIKELY(!impl)) {
110         v8SetReturnValueNull(callbackInfo);
111         return;
112     }
113     if (DOMDataStore::setReturnValueFromWrapper<V8TestObject>(callbackInfo.GetReturnValue(), impl))
114         return;
115     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
116     v8SetReturnValue(callbackInfo, wrapper);
117 }
118
119 template<typename CallbackInfo>
120 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestObject* impl)
121 {
122     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
123     if (UNLIKELY(!impl)) {
124         v8SetReturnValueNull(callbackInfo);
125         return;
126     }
127     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObject>(callbackInfo.GetReturnValue(), impl))
128         return;
129     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
130     v8SetReturnValue(callbackInfo, wrapper);
131 }
132
133 template<class CallbackInfo, class Wrappable>
134 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestObject* impl, Wrappable* wrappable)
135 {
136     if (UNLIKELY(!impl)) {
137         v8SetReturnValueNull(callbackInfo);
138         return;
139     }
140     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestObject>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
141         return;
142     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
143     v8SetReturnValue(callbackInfo, wrapper);
144 }
145
146 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
147 {
148     return toV8(impl.get(), creationContext, isolate);
149 }
150
151 template<class CallbackInfo>
152 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
153 {
154     v8SetReturnValue(callbackInfo, impl.get());
155 }
156
157 template<class CallbackInfo>
158 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
159 {
160     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
161 }
162
163 template<class CallbackInfo, class Wrappable>
164 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl, Wrappable* wrappable)
165 {
166     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
167 }
168
169 } // namespace blink
170 #endif // V8TestObject_h