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