Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterfaceGarbageCollected.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 V8TestInterfaceGarbageCollected_h
8 #define V8TestInterfaceGarbageCollected_h
9
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"
16
17 namespace WebCore {
18
19 class V8TestInterfaceGarbageCollected {
20 public:
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)
25     {
26         return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
27     }
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)
37     {
38         return V8EventTarget::toInternalPointer(impl);
39     }
40
41     static inline TestInterfaceGarbageCollected* fromInternalPointer(void* object)
42     {
43         return static_cast<TestInterfaceGarbageCollected*>(V8EventTarget::fromInternalPointer(object));
44     }
45     static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceGarbageCollected*, v8::Isolate*) { }
46     static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
47
48 private:
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*);
51 };
52
53 inline v8::Handle<v8::Object> wrap(TestInterfaceGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
54 {
55     ASSERT(impl);
56     ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceGarbageCollected>(impl, isolate));
57     return V8TestInterfaceGarbageCollected::createWrapper(impl, creationContext, isolate);
58 }
59
60 inline v8::Handle<v8::Value> toV8(TestInterfaceGarbageCollected* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
61 {
62     if (UNLIKELY(!impl))
63         return v8::Null(isolate);
64     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceGarbageCollected>(impl, isolate);
65     if (!wrapper.IsEmpty())
66         return wrapper;
67     return wrap(impl, creationContext, isolate);
68 }
69
70 template<typename CallbackInfo>
71 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollected* impl)
72 {
73     if (UNLIKELY(!impl)) {
74         v8SetReturnValueNull(callbackInfo);
75         return;
76     }
77     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceGarbageCollected>(callbackInfo.GetReturnValue(), impl))
78         return;
79     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
80     v8SetReturnValue(callbackInfo, wrapper);
81 }
82
83 template<typename CallbackInfo>
84 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollected* impl)
85 {
86     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
87     if (UNLIKELY(!impl)) {
88         v8SetReturnValueNull(callbackInfo);
89         return;
90     }
91     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceGarbageCollected>(callbackInfo.GetReturnValue(), impl))
92         return;
93     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
94     v8SetReturnValue(callbackInfo, wrapper);
95 }
96
97 template<class CallbackInfo, class Wrappable>
98 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceGarbageCollected* impl, Wrappable* wrappable)
99 {
100     if (UNLIKELY(!impl)) {
101         v8SetReturnValueNull(callbackInfo);
102         return;
103     }
104     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceGarbageCollected>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
105         return;
106     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
107     v8SetReturnValue(callbackInfo, wrapper);
108 }
109
110
111 }
112 #endif // V8TestInterfaceGarbageCollected_h