Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterface2.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 V8TestInterface2_h
8 #define V8TestInterface2_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/TestInterface2.h"
15 #include "platform/heap/Handle.h"
16
17 namespace blink {
18
19 class V8TestInterface2 {
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 TestInterface2* toNative(v8::Handle<v8::Object> object)
25     {
26         return fromInternalPointer(blink::toInternalPointer(object));
27     }
28     static TestInterface2* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
29     static const WrapperTypeInfo wrapperTypeInfo;
30     static void derefObject(ScriptWrappableBase* internalPointer);
31     static void visitDOMWrapper(ScriptWrappableBase* internalPointer, const v8::Persistent<v8::Object>&, v8::Isolate*);
32     static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
33     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
34     static inline ScriptWrappableBase* toInternalPointer(TestInterface2* impl)
35     {
36         return reinterpret_cast<ScriptWrappableBase*>(static_cast<void*>(impl));
37     }
38
39     static inline TestInterface2* fromInternalPointer(ScriptWrappableBase* internalPointer)
40     {
41         return reinterpret_cast<TestInterface2*>(static_cast<void*>(internalPointer));
42     }
43     static void installConditionallyEnabledProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
44     static void installConditionallyEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
45
46 private:
47     friend v8::Handle<v8::Object> wrap(TestInterface2*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
48     static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterface2>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
49 };
50
51 v8::Handle<v8::Object> wrap(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
52
53 inline v8::Handle<v8::Value> toV8(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
54 {
55     if (UNLIKELY(!impl))
56         return v8::Null(isolate);
57     v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterface2>(impl, isolate);
58     if (!wrapper.IsEmpty())
59         return wrapper;
60     return wrap(impl, creationContext, isolate);
61 }
62
63 template<typename CallbackInfo>
64 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterface2* impl)
65 {
66     if (UNLIKELY(!impl)) {
67         v8SetReturnValueNull(callbackInfo);
68         return;
69     }
70     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterface2>(callbackInfo.GetReturnValue(), impl))
71         return;
72     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
73     v8SetReturnValue(callbackInfo, wrapper);
74 }
75
76 template<typename CallbackInfo>
77 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterface2* impl)
78 {
79     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
80     if (UNLIKELY(!impl)) {
81         v8SetReturnValueNull(callbackInfo);
82         return;
83     }
84     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterface2>(callbackInfo.GetReturnValue(), impl))
85         return;
86     v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
87     v8SetReturnValue(callbackInfo, wrapper);
88 }
89
90 template<class CallbackInfo, class Wrappable>
91 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterface2* impl, Wrappable* wrappable)
92 {
93     if (UNLIKELY(!impl)) {
94         v8SetReturnValueNull(callbackInfo);
95         return;
96     }
97     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterface2>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
98         return;
99     v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
100     v8SetReturnValue(callbackInfo, wrapper);
101 }
102
103 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
104 {
105     return toV8(impl.get(), creationContext, isolate);
106 }
107
108 template<class CallbackInfo>
109 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface2> impl)
110 {
111     v8SetReturnValue(callbackInfo, impl.get());
112 }
113
114 template<class CallbackInfo>
115 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface2> impl)
116 {
117     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
118 }
119
120 template<class CallbackInfo, class Wrappable>
121 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterface2> impl, Wrappable* wrappable)
122 {
123     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
124 }
125
126 }
127 #endif // V8TestInterface2_h