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 V8TestInterfaceEventTarget_h
34 #define V8TestInterfaceEventTarget_h
36 #include "V8EventTarget.h"
37 #include "bindings/tests/idls/TestInterfaceEventTarget.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 V8TestInterfaceEventTargetConstructor {
47 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
48 static const WrapperTypeInfo wrapperTypeInfo;
51 class V8TestInterfaceEventTarget {
53 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
54 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
55 static TestInterfaceEventTarget* toNative(v8::Handle<v8::Object> object)
57 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
59 static const WrapperTypeInfo wrapperTypeInfo;
60 static void derefObject(void*);
61 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
62 static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
63 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
64 static inline void* toInternalPointer(TestInterfaceEventTarget* impl)
66 return V8EventTarget::toInternalPointer(impl);
69 static inline TestInterfaceEventTarget* fromInternalPointer(void* object)
71 return static_cast<TestInterfaceEventTarget*>(V8EventTarget::fromInternalPointer(object));
73 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceEventTarget*, v8::Isolate*) { }
74 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
77 friend v8::Handle<v8::Object> wrap(TestInterfaceEventTarget*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
78 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterfaceEventTarget>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
82 class WrapperTypeTraits<TestInterfaceEventTarget > {
84 static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestInterfaceEventTarget::wrapperTypeInfo; }
87 inline v8::Handle<v8::Object> wrap(TestInterfaceEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
90 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventTarget>(impl, isolate));
91 return V8TestInterfaceEventTarget::createWrapper(impl, creationContext, isolate);
94 inline v8::Handle<v8::Value> toV8(TestInterfaceEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
97 return v8::Null(isolate);
98 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceEventTarget>(impl, isolate);
99 if (!wrapper.IsEmpty())
101 return wrap(impl, creationContext, isolate);
104 template<typename CallbackInfo>
105 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceEventTarget* impl)
107 if (UNLIKELY(!impl)) {
108 v8SetReturnValueNull(callbackInfo);
111 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEventTarget>(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, TestInterfaceEventTarget* impl)
120 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
121 if (UNLIKELY(!impl)) {
122 v8SetReturnValueNull(callbackInfo);
125 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceEventTarget>(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, TestInterfaceEventTarget* impl, Wrappable* wrappable)
134 if (UNLIKELY(!impl)) {
135 v8SetReturnValueNull(callbackInfo);
138 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceEventTarget>(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<TestInterfaceEventTarget> 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<TestInterfaceEventTarget> impl)
152 v8SetReturnValue(callbackInfo, impl.get());
155 template<class CallbackInfo>
156 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceEventTarget> impl)
158 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
161 template<class CallbackInfo, class Wrappable>
162 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceEventTarget> impl, Wrappable* wrappable)
164 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
168 #endif // V8TestInterfaceEventTarget_h