2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
33 #ifndef V8TestInterface_h
34 #define V8TestInterface_h
36 #if ENABLE(Condition1) || ENABLE(Condition2)
37 #include "bindings/tests/idls/TestInterface.h"
38 #include "bindings/v8/V8Binding.h"
39 #include "bindings/v8/V8DOMWrapper.h"
40 #include "bindings/v8/WrapperTypeInfo.h"
41 #include "heap/Handle.h"
45 class V8TestInterface {
47 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
48 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
49 static TestInterface* toNative(v8::Handle<v8::Object> object)
51 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
53 static const WrapperTypeInfo wrapperTypeInfo;
54 static void derefObject(void*);
55 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Isolate*);
56 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
57 static void implementsCustomVoidMethodMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
58 #if ENABLE(CONDITION_PARTIAL)
59 static void supplementalMethod3MethodCustom(const v8::FunctionCallbackInfo<v8::Value>&);
60 #endif // ENABLE(CONDITION_PARTIAL)
61 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
62 static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
63 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
64 static inline void* toInternalPointer(TestInterface* impl)
69 static inline TestInterface* fromInternalPointer(void* object)
71 return static_cast<TestInterface*>(object);
73 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterface*, v8::Isolate*);
74 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
77 friend v8::Handle<v8::Object> wrap(TestInterface*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
78 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterface>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
82 class WrapperTypeTraits<TestInterface > {
84 static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestInterface::wrapperTypeInfo; }
87 inline v8::Handle<v8::Object> wrap(TestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
90 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface>(impl, isolate));
91 return V8TestInterface::createWrapper(impl, creationContext, isolate);
94 inline v8::Handle<v8::Value> toV8(TestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
97 return v8::Null(isolate);
98 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterface>(impl, isolate);
99 if (!wrapper.IsEmpty())
101 return wrap(impl, creationContext, isolate);
104 template<typename CallbackInfo>
105 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterface* impl)
107 if (UNLIKELY(!impl)) {
108 v8SetReturnValueNull(callbackInfo);
111 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterface>(callbackInfo.GetReturnValue(), impl))
113 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
114 v8SetReturnValue(callbackInfo, wrapper);
117 template<typename CallbackInfo>
118 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterface* impl)
120 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
121 if (UNLIKELY(!impl)) {
122 v8SetReturnValueNull(callbackInfo);
125 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterface>(callbackInfo.GetReturnValue(), impl))
127 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
128 v8SetReturnValue(callbackInfo, wrapper);
131 template<class CallbackInfo, class Wrappable>
132 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterface* impl, Wrappable* wrappable)
134 if (UNLIKELY(!impl)) {
135 v8SetReturnValueNull(callbackInfo);
138 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterface>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
140 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
141 v8SetReturnValue(callbackInfo, wrapper);
144 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
146 return toV8(impl.get(), creationContext, isolate);
149 template<class CallbackInfo>
150 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface> impl)
152 v8SetReturnValue(callbackInfo, impl.get());
155 template<class CallbackInfo>
156 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface> impl)
158 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
161 template<class CallbackInfo, class Wrappable>
162 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface> impl, Wrappable* wrappable)
164 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
168 #endif // ENABLE(Condition1) || ENABLE(Condition2)
169 #endif // V8TestInterface_h