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