Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterfaceWillBeGarbageCollected.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 V8TestInterfaceWillBeGarbageCollected_h
34 #define V8TestInterfaceWillBeGarbageCollected_h
35
36 #include "V8EventTarget.h"
37 #include "bindings/tests/idls/TestInterfaceWillBeGarbageCollected.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 V8TestInterfaceWillBeGarbageCollected {
46 public:
47     static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
48     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
49     static TestInterfaceWillBeGarbageCollected* 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 void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
57     static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
58     static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 1;
59     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 2;
60     static inline void* toInternalPointer(TestInterfaceWillBeGarbageCollected* impl)
61     {
62         return V8EventTarget::toInternalPointer(impl);
63     }
64
65     static inline TestInterfaceWillBeGarbageCollected* fromInternalPointer(void* object)
66     {
67         return static_cast<TestInterfaceWillBeGarbageCollected*>(V8EventTarget::fromInternalPointer(object));
68     }
69     static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceWillBeGarbageCollected*, v8::Isolate*) { }
70     static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
71
72 private:
73     friend v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
74     static v8::Handle<v8::Object> createWrapper(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
75 };
76
77 template<>
78 class WrapperTypeTraits<TestInterfaceWillBeGarbageCollected > {
79 public:
80     static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo; }
81 };
82
83 inline v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
84 {
85     ASSERT(impl);
86     ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceWillBeGarbageCollected>(impl, isolate));
87     return V8TestInterfaceWillBeGarbageCollected::createWrapper(impl, creationContext, isolate);
88 }
89
90 inline v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollected* 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<V8TestInterfaceWillBeGarbageCollected>(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, TestInterfaceWillBeGarbageCollected* impl)
102 {
103     if (UNLIKELY(!impl)) {
104         v8SetReturnValueNull(callbackInfo);
105         return;
106     }
107     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceWillBeGarbageCollected>(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, TestInterfaceWillBeGarbageCollected* impl)
115 {
116     ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
117     if (UNLIKELY(!impl)) {
118         v8SetReturnValueNull(callbackInfo);
119         return;
120     }
121     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceWillBeGarbageCollected>(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, TestInterfaceWillBeGarbageCollected* impl, Wrappable* wrappable)
129 {
130     if (UNLIKELY(!impl)) {
131         v8SetReturnValueNull(callbackInfo);
132         return;
133     }
134     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceWillBeGarbageCollected>(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(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> 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, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
147 {
148     v8SetReturnValue(callbackInfo, impl.get());
149 }
150
151 template<class CallbackInfo>
152 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
153 {
154     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
155 }
156
157 template<class CallbackInfo, class Wrappable>
158 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, Wrappable* wrappable)
159 {
160     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
161 }
162
163 }
164 #endif // V8TestInterfaceWillBeGarbageCollected_h