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 V8TestInterfaceWillBeGarbageCollected_h
34 #define V8TestInterfaceWillBeGarbageCollected_h
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"
45 class V8TestInterfaceWillBeGarbageCollected {
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)
51 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
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)
62 return V8EventTarget::toInternalPointer(impl);
65 static inline TestInterfaceWillBeGarbageCollected* fromInternalPointer(void* object)
67 return static_cast<TestInterfaceWillBeGarbageCollected*>(V8EventTarget::fromInternalPointer(object));
69 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceWillBeGarbageCollected*, v8::Isolate*) { }
70 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
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*);
78 class WrapperTypeTraits<TestInterfaceWillBeGarbageCollected > {
80 static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo; }
83 inline v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
86 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceWillBeGarbageCollected>(impl, isolate));
87 return V8TestInterfaceWillBeGarbageCollected::createWrapper(impl, creationContext, isolate);
90 inline v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
93 return v8::Null(isolate);
94 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceWillBeGarbageCollected>(impl, isolate);
95 if (!wrapper.IsEmpty())
97 return wrap(impl, creationContext, isolate);
100 template<typename CallbackInfo>
101 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
103 if (UNLIKELY(!impl)) {
104 v8SetReturnValueNull(callbackInfo);
107 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
109 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
110 v8SetReturnValue(callbackInfo, wrapper);
113 template<typename CallbackInfo>
114 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
116 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
117 if (UNLIKELY(!impl)) {
118 v8SetReturnValueNull(callbackInfo);
121 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
123 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
124 v8SetReturnValue(callbackInfo, wrapper);
127 template<class CallbackInfo, class Wrappable>
128 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl, Wrappable* wrappable)
130 if (UNLIKELY(!impl)) {
131 v8SetReturnValueNull(callbackInfo);
134 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
136 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
137 v8SetReturnValue(callbackInfo, wrapper);
140 inline v8::Handle<v8::Value> toV8(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
142 return toV8(impl.get(), creationContext, isolate);
145 template<class CallbackInfo>
146 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
148 v8SetReturnValue(callbackInfo, impl.get());
151 template<class CallbackInfo>
152 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
154 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
157 template<class CallbackInfo, class Wrappable>
158 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, Wrappable* wrappable)
160 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
164 #endif // V8TestInterfaceWillBeGarbageCollected_h