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