Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestObjectPython.h
1 /*
2  * Copyright (C) 2013 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
32
33 #ifndef V8TestObjectPython_h
34 #define V8TestObjectPython_h
35
36 #include "bindings/tests/idls/TestObjectPython.h"
37 #include "bindings/v8/V8Binding.h"
38 #include "bindings/v8/V8DOMWrapper.h"
39 #include "bindings/v8/WrapperTypeInfo.h"
40 #include "heap/Handle.h"
41
42 namespace WebCore {
43
44 class V8TestObjectPython {
45 public:
46     static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
47     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
48     static TestObjectPython* toNative(v8::Handle<v8::Object> object)
49     {
50         return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
51     }
52     static const WrapperTypeInfo wrapperTypeInfo;
53     static void derefObject(void*);
54     static void customVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
55 #if ENABLE(CONDITION)
56     static void conditionalConditionCustomVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
57 #endif // ENABLE(CONDITION)
58     static void customObjectAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
59     static void customObjectAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
60     static void customGetterLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
61     static void customGetterReadonlyObjectAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
62     static void customSetterLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
63 #if ENABLE(CONDITION)
64     static void customLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
65 #endif // ENABLE(CONDITION)
66 #if ENABLE(CONDITION)
67     static void customLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
68 #endif // ENABLE(CONDITION)
69     static void customImplementedAsLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
70     static void customImplementedAsLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
71     static void customGetterImplementedAsLongAttributeAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>&);
72     static void customSetterImplementedAsLongAttributeAttributeSetterCustom(v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
73     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
74     static inline void* toInternalPointer(TestObjectPython* impl)
75     {
76         return impl;
77     }
78
79     static inline TestObjectPython* fromInternalPointer(void* object)
80     {
81         return static_cast<TestObjectPython*>(object);
82     }
83     static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestObjectPython*, v8::Isolate*);
84     static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*);
85
86 private:
87     friend v8::Handle<v8::Object> wrap(TestObjectPython*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
88     static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestObjectPython>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
89 };
90
91 template<>
92 class WrapperTypeTraits<TestObjectPython > {
93 public:
94     static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestObjectPython::wrapperTypeInfo; }
95 };
96
97 inline v8::Handle<v8::Object> wrap(TestObjectPython* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
98 {
99     ASSERT(impl);
100     ASSERT(!DOMDataStore::containsWrapper<V8TestObjectPython>(impl, isolate));
101     return V8TestObjectPython::createWrapper(impl, creationContext, isolate);
102 }
103
104 inline v8::Handle<v8::Value> toV8(TestObjectPython* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
105 {
106     if (UNLIKELY(!impl))
107         return v8::Null(isolate);
108     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObjectPython>(impl, isolate);
109     if (!wrapper.IsEmpty())
110         return wrapper;
111     return wrap(impl, creationContext, isolate);
112 }
113
114 template<typename CallbackInfo>
115 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestObjectPython* impl)
116 {
117     if (UNLIKELY(!impl)) {
118         v8SetReturnValueNull(callbackInfo);
119         return;
120     }
121     if (DOMDataStore::setReturnValueFromWrapper<V8TestObjectPython>(callbackInfo.GetReturnValue(), impl))
122         return;
123     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
124     v8SetReturnValue(callbackInfo, wrapper);
125 }
126
127 template<typename CallbackInfo>
128 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestObjectPython* impl)
129 {
130     ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
131     if (UNLIKELY(!impl)) {
132         v8SetReturnValueNull(callbackInfo);
133         return;
134     }
135     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestObjectPython>(callbackInfo.GetReturnValue(), impl))
136         return;
137     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
138     v8SetReturnValue(callbackInfo, wrapper);
139 }
140
141 template<class CallbackInfo, class Wrappable>
142 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestObjectPython* impl, Wrappable* wrappable)
143 {
144     if (UNLIKELY(!impl)) {
145         v8SetReturnValueNull(callbackInfo);
146         return;
147     }
148     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestObjectPython>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
149         return;
150     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
151     v8SetReturnValue(callbackInfo, wrapper);
152 }
153
154 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestObjectPython> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
155 {
156     return toV8(impl.get(), creationContext, isolate);
157 }
158
159 template<class CallbackInfo>
160 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestObjectPython> impl)
161 {
162     v8SetReturnValue(callbackInfo, impl.get());
163 }
164
165 template<class CallbackInfo>
166 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestObjectPython> impl)
167 {
168     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
169 }
170
171 template<class CallbackInfo, class Wrappable>
172 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestObjectPython> impl, Wrappable* wrappable)
173 {
174     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
175 }
176
177 }
178 #endif // V8TestObjectPython_h