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 V8TestEventTarget_h
34 #define V8TestEventTarget_h
36 #include "V8EventTarget.h"
37 #include "bindings/tests/idls/TestEventTarget.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 V8TestEventTarget {
47 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
48 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
49 static TestEventTarget* 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 const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
57 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
58 static inline void* toInternalPointer(TestEventTarget* impl)
60 return V8EventTarget::toInternalPointer(impl);
63 static inline TestEventTarget* fromInternalPointer(void* object)
65 return static_cast<TestEventTarget*>(V8EventTarget::fromInternalPointer(object));
67 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestEventTarget*, v8::Isolate*) { }
68 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
71 friend v8::Handle<v8::Object> wrap(TestEventTarget*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
72 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestEventTarget>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
76 class WrapperTypeTraits<TestEventTarget > {
78 static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestEventTarget::wrapperTypeInfo; }
81 inline v8::Handle<v8::Object> wrap(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
84 ASSERT(!DOMDataStore::containsWrapper<V8TestEventTarget>(impl, isolate));
85 return V8TestEventTarget::createWrapper(impl, creationContext, isolate);
88 inline v8::Handle<v8::Value> toV8(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
91 return v8::Null(isolate);
92 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestEventTarget>(impl, isolate);
93 if (!wrapper.IsEmpty())
95 return wrap(impl, creationContext, isolate);
98 template<typename CallbackInfo>
99 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestEventTarget* impl)
101 if (UNLIKELY(!impl)) {
102 v8SetReturnValueNull(callbackInfo);
105 if (DOMDataStore::setReturnValueFromWrapper<V8TestEventTarget>(callbackInfo.GetReturnValue(), impl))
107 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
108 v8SetReturnValue(callbackInfo, wrapper);
111 template<typename CallbackInfo>
112 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestEventTarget* impl)
114 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
115 if (UNLIKELY(!impl)) {
116 v8SetReturnValueNull(callbackInfo);
119 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestEventTarget>(callbackInfo.GetReturnValue(), impl))
121 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
122 v8SetReturnValue(callbackInfo, wrapper);
125 template<class CallbackInfo, class Wrappable>
126 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestEventTarget* impl, Wrappable* wrappable)
128 if (UNLIKELY(!impl)) {
129 v8SetReturnValueNull(callbackInfo);
132 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestEventTarget>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
134 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
135 v8SetReturnValue(callbackInfo, wrapper);
138 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
140 return toV8(impl.get(), creationContext, isolate);
143 template<class CallbackInfo>
144 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestEventTarget> impl)
146 v8SetReturnValue(callbackInfo, impl.get());
149 template<class CallbackInfo>
150 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestEventTarget> impl)
152 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
155 template<class CallbackInfo, class Wrappable>
156 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestEventTarget> impl, Wrappable* wrappable)
158 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
162 #endif // V8TestEventTarget_h