Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterfacePython2.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 V8TestInterfacePython2_h
34 #define V8TestInterfacePython2_h
35
36 #include "bindings/tests/idls/TestInterfacePython2.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 V8TestInterfacePython2 {
45 public:
46     static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
47     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
48     static TestInterfacePython2* 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 visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Isolate*);
55     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
56     static inline void* toInternalPointer(TestInterfacePython2* impl)
57     {
58         return impl;
59     }
60
61     static inline TestInterfacePython2* fromInternalPointer(void* object)
62     {
63         return static_cast<TestInterfacePython2*>(object);
64     }
65     static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfacePython2*, v8::Isolate*) { }
66     static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
67
68 private:
69     friend v8::Handle<v8::Object> wrap(TestInterfacePython2*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
70     static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterfacePython2>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
71 };
72
73 template<>
74 class WrapperTypeTraits<TestInterfacePython2 > {
75 public:
76     static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestInterfacePython2::wrapperTypeInfo; }
77 };
78
79 v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
80
81 inline v8::Handle<v8::Value> toV8(TestInterfacePython2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
82 {
83     if (UNLIKELY(!impl))
84         return v8::Null(isolate);
85     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfacePython2>(impl, isolate);
86     if (!wrapper.IsEmpty())
87         return wrapper;
88     return wrap(impl, creationContext, isolate);
89 }
90
91 template<typename CallbackInfo>
92 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfacePython2* impl)
93 {
94     if (UNLIKELY(!impl)) {
95         v8SetReturnValueNull(callbackInfo);
96         return;
97     }
98     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfacePython2>(callbackInfo.GetReturnValue(), impl))
99         return;
100     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
101     v8SetReturnValue(callbackInfo, wrapper);
102 }
103
104 template<typename CallbackInfo>
105 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfacePython2* impl)
106 {
107     ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
108     if (UNLIKELY(!impl)) {
109         v8SetReturnValueNull(callbackInfo);
110         return;
111     }
112     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfacePython2>(callbackInfo.GetReturnValue(), impl))
113         return;
114     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
115     v8SetReturnValue(callbackInfo, wrapper);
116 }
117
118 template<class CallbackInfo, class Wrappable>
119 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfacePython2* impl, Wrappable* wrappable)
120 {
121     if (UNLIKELY(!impl)) {
122         v8SetReturnValueNull(callbackInfo);
123         return;
124     }
125     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfacePython2>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
126         return;
127     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
128     v8SetReturnValue(callbackInfo, wrapper);
129 }
130
131 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterfacePython2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
132 {
133     return toV8(impl.get(), creationContext, isolate);
134 }
135
136 template<class CallbackInfo>
137 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfacePython2> impl)
138 {
139     v8SetReturnValue(callbackInfo, impl.get());
140 }
141
142 template<class CallbackInfo>
143 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfacePython2> impl)
144 {
145     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
146 }
147
148 template<class CallbackInfo, class Wrappable>
149 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfacePython2> impl, Wrappable* wrappable)
150 {
151     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
152 }
153
154 }
155 #endif // V8TestInterfacePython2_h