1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
7 #ifndef V8TestInterfaceGarbageCollected_h
8 #define V8TestInterfaceGarbageCollected_h
10 #include "V8EventTarget.h"
11 #include "bindings/tests/idls/TestInterfaceGarbageCollected.h"
12 #include "bindings/v8/V8Binding.h"
13 #include "bindings/v8/V8DOMWrapper.h"
14 #include "bindings/v8/WrapperTypeInfo.h"
15 #include "platform/heap/Handle.h"
19 class V8TestInterfaceGarbageCollected {
21 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
22 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
23 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
24 static TestInterfaceGarbageCollected* toNative(v8::Handle<v8::Object> object)
26 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
28 static TestInterfaceGarbageCollected* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
29 static const WrapperTypeInfo wrapperTypeInfo;
30 static void derefObject(void*);
31 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
32 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
33 static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
34 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 1;
35 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 2;
36 static inline void* toInternalPointer(TestInterfaceGarbageCollected* impl)
38 return V8EventTarget::toInternalPointer(impl);
41 static inline TestInterfaceGarbageCollected* fromInternalPointer(void* object)
43 return static_cast<TestInterfaceGarbageCollected*>(V8EventTarget::fromInternalPointer(object));
45 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceGarbageCollected*, v8::Isolate*) { }
46 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
49 friend v8::Handle<v8::Object> wrap(TestInterfaceGarbageCollected*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
50 static v8::Handle<v8::Object> createWrapper(RawPtr<TestInterfaceGarbageCollected>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
53 inline v8::Handle<v8::Object> wrap(TestInterfaceGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
56 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceGarbageCollected>(impl, isolate));
57 return V8TestInterfaceGarbageCollected::createWrapper(impl, creationContext, isolate);
60 inline v8::Handle<v8::Value> toV8(TestInterfaceGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
63 return v8::Null(isolate);
64 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceGarbageCollected>(impl, isolate);
65 if (!wrapper.IsEmpty())
67 return wrap(impl, creationContext, isolate);
70 template<typename CallbackInfo>
71 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollected* impl)
73 if (UNLIKELY(!impl)) {
74 v8SetReturnValueNull(callbackInfo);
77 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceGarbageCollected>(callbackInfo.GetReturnValue(), impl))
79 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
80 v8SetReturnValue(callbackInfo, wrapper);
83 template<typename CallbackInfo>
84 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollected* impl)
86 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
87 if (UNLIKELY(!impl)) {
88 v8SetReturnValueNull(callbackInfo);
91 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceGarbageCollected>(callbackInfo.GetReturnValue(), impl))
93 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
94 v8SetReturnValue(callbackInfo, wrapper);
97 template<class CallbackInfo, class Wrappable>
98 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollected* impl, Wrappable* wrappable)
100 if (UNLIKELY(!impl)) {
101 v8SetReturnValueNull(callbackInfo);
104 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceGarbageCollected>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
106 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
107 v8SetReturnValue(callbackInfo, wrapper);
112 #endif // V8TestInterfaceGarbageCollected_h