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