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 V8TestInterfaceWillBeGarbageCollected_h
8 #define V8TestInterfaceWillBeGarbageCollected_h
10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/core/v8/V8DOMWrapper.h"
13 #include "bindings/core/v8/WrapperTypeInfo.h"
14 #include "bindings/tests/idls/TestInterfaceWillBeGarbageCollected.h"
15 #include "bindings/tests/v8/V8EventTarget.h"
16 #include "platform/heap/Handle.h"
20 class V8TestInterfaceWillBeGarbageCollectedConstructor {
22 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
23 static const WrapperTypeInfo wrapperTypeInfo;
26 class V8TestInterfaceWillBeGarbageCollected {
28 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
29 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
30 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
31 static TestInterfaceWillBeGarbageCollected* toNative(v8::Handle<v8::Object> object)
33 return fromInternalPointer(blink::toInternalPointer(object));
35 static TestInterfaceWillBeGarbageCollected* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
36 static const WrapperTypeInfo wrapperTypeInfo;
37 static void derefObject(ScriptWrappableBase* internalPointer);
38 static EventTarget* toEventTarget(v8::Handle<v8::Object>);
39 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
40 static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
42 static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 1;
43 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1 + 1;
45 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
47 static inline ScriptWrappableBase* toInternalPointer(TestInterfaceWillBeGarbageCollected* impl)
49 return V8EventTarget::toInternalPointer(impl);
52 static inline TestInterfaceWillBeGarbageCollected* fromInternalPointer(ScriptWrappableBase* internalPointer)
54 return static_cast<TestInterfaceWillBeGarbageCollected*>(V8EventTarget::fromInternalPointer(internalPointer));
56 static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
57 static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
60 friend v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
61 static v8::Handle<v8::Object> createWrapper(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
64 v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
66 inline v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
69 return v8::Null(isolate);
70 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceWillBeGarbageCollected>(impl, isolate);
71 if (!wrapper.IsEmpty())
73 return wrap(impl, creationContext, isolate);
76 template<typename CallbackInfo>
77 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
79 if (UNLIKELY(!impl)) {
80 v8SetReturnValueNull(callbackInfo);
83 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
85 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
86 v8SetReturnValue(callbackInfo, wrapper);
89 template<typename CallbackInfo>
90 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
92 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
93 if (UNLIKELY(!impl)) {
94 v8SetReturnValueNull(callbackInfo);
97 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
99 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
100 v8SetReturnValue(callbackInfo, wrapper);
103 template<class CallbackInfo, class Wrappable>
104 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl, Wrappable* wrappable)
106 if (UNLIKELY(!impl)) {
107 v8SetReturnValueNull(callbackInfo);
110 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
112 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
113 v8SetReturnValue(callbackInfo, wrapper);
116 inline v8::Handle<v8::Value> toV8(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
118 return toV8(impl.get(), creationContext, isolate);
121 template<class CallbackInfo>
122 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
124 v8SetReturnValue(callbackInfo, impl.get());
127 template<class CallbackInfo>
128 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
130 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
133 template<class CallbackInfo, class Wrappable>
134 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, Wrappable* wrappable)
136 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
140 #endif // V8TestInterfaceWillBeGarbageCollected_h