Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / 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/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     };
40
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)
45     {
46         return fromInternalPointer(blink::toInternalPointer(object));
47     }
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>&);
52 #if ENABLE(CONDITION)
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>&);
60 #if ENABLE(CONDITION)
61     static void customLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
62 #endif // ENABLE(CONDITION)
63 #if 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)
72     {
73         return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
74     }
75
76     static inline TestObject* fromInternalPointer(ScriptWrappableBase* internalPointer)
77     {
78         return reinterpret_cast<TestObject*>(static_cast<void*>(internalPointer));
79     }
80     static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*);
81     static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*);
82
83 private:
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*);
86 };
87
88 v8::Handle<v8::Object> wrap(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
89
90 inline v8::Handle<v8::Value> toV8(TestObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
91 {
92     if (UNLIKELY(!impl))
93         return v8::Null(isolate);
94     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObject>(impl, isolate);
95     if (!wrapper.IsEmpty())
96         return wrapper;
97     return wrap(impl, creationContext, isolate);
98 }
99
100 template<typename CallbackInfo>
101 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestObject* impl)
102 {
103     if (UNLIKELY(!impl)) {
104         v8SetReturnValueNull(callbackInfo);
105         return;
106     }
107     if (DOMDataStore::setReturnValueFromWrapper<V8TestObject>(callbackInfo.GetReturnValue(), impl))
108         return;
109     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
110     v8SetReturnValue(callbackInfo, wrapper);
111 }
112
113 template<typename CallbackInfo>
114 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestObject* impl)
115 {
116     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
117     if (UNLIKELY(!impl)) {
118         v8SetReturnValueNull(callbackInfo);
119         return;
120     }
121     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObject>(callbackInfo.GetReturnValue(), impl))
122         return;
123     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
124     v8SetReturnValue(callbackInfo, wrapper);
125 }
126
127 template<class CallbackInfo, class Wrappable>
128 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestObject* impl, Wrappable* wrappable)
129 {
130     if (UNLIKELY(!impl)) {
131         v8SetReturnValueNull(callbackInfo);
132         return;
133     }
134     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestObject>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
135         return;
136     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
137     v8SetReturnValue(callbackInfo, wrapper);
138 }
139
140 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
141 {
142     return toV8(impl.get(), creationContext, isolate);
143 }
144
145 template<class CallbackInfo>
146 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
147 {
148     v8SetReturnValue(callbackInfo, impl.get());
149 }
150
151 template<class CallbackInfo>
152 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl)
153 {
154     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
155 }
156
157 template<class CallbackInfo, class Wrappable>
158 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestObject> impl, Wrappable* wrappable)
159 {
160     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
161 }
162
163 }
164 #endif // V8TestObject_h