Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterfaceWillBeGarbageCollected.h
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.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #ifndef V8TestInterfaceWillBeGarbageCollected_h
8 #define V8TestInterfaceWillBeGarbageCollected_h
9
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"
17
18 namespace blink {
19
20 class V8TestInterfaceWillBeGarbageCollectedConstructor {
21 public:
22     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
23     static const WrapperTypeInfo wrapperTypeInfo;
24 };
25
26 class V8TestInterfaceWillBeGarbageCollected {
27 public:
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)
32     {
33         return fromInternalPointer(blink::toInternalPointer(object));
34     }
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;
41 #if ENABLE(OILPAN)
42     static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 1;
43     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1 + 1;
44 #else
45     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
46 #endif
47     static inline ScriptWrappableBase* toInternalPointer(TestInterfaceWillBeGarbageCollected* impl)
48     {
49         return V8EventTarget::toInternalPointer(impl);
50     }
51
52     static inline TestInterfaceWillBeGarbageCollected* fromInternalPointer(ScriptWrappableBase* internalPointer)
53     {
54         return static_cast<TestInterfaceWillBeGarbageCollected*>(V8EventTarget::fromInternalPointer(internalPointer));
55     }
56     static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
57     static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
58
59 private:
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*);
62 };
63
64 v8::Handle<v8::Object> wrap(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
65
66 inline v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
67 {
68     if (UNLIKELY(!impl))
69         return v8::Null(isolate);
70     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceWillBeGarbageCollected>(impl, isolate);
71     if (!wrapper.IsEmpty())
72         return wrapper;
73     return wrap(impl, creationContext, isolate);
74 }
75
76 template<typename CallbackInfo>
77 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
78 {
79     if (UNLIKELY(!impl)) {
80         v8SetReturnValueNull(callbackInfo);
81         return;
82     }
83     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
84         return;
85     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
86     v8SetReturnValue(callbackInfo, wrapper);
87 }
88
89 template<typename CallbackInfo>
90 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl)
91 {
92     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
93     if (UNLIKELY(!impl)) {
94         v8SetReturnValueNull(callbackInfo);
95         return;
96     }
97     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl))
98         return;
99     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
100     v8SetReturnValue(callbackInfo, wrapper);
101 }
102
103 template<class CallbackInfo, class Wrappable>
104 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceWillBeGarbageCollected* impl, Wrappable* wrappable)
105 {
106     if (UNLIKELY(!impl)) {
107         v8SetReturnValueNull(callbackInfo);
108         return;
109     }
110     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceWillBeGarbageCollected>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
111         return;
112     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
113     v8SetReturnValue(callbackInfo, wrapper);
114 }
115
116 inline v8::Handle<v8::Value> toV8(PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
117 {
118     return toV8(impl.get(), creationContext, isolate);
119 }
120
121 template<class CallbackInfo>
122 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
123 {
124     v8SetReturnValue(callbackInfo, impl.get());
125 }
126
127 template<class CallbackInfo>
128 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl)
129 {
130     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
131 }
132
133 template<class CallbackInfo, class Wrappable>
134 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl, Wrappable* wrappable)
135 {
136     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
137 }
138
139 }
140 #endif // V8TestInterfaceWillBeGarbageCollected_h