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