Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8TestInterfaceDocument.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 V8TestInterfaceDocument_h
8 #define V8TestInterfaceDocument_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/TestInterfaceDocument.h"
15 #include "bindings/tests/v8/V8Document.h"
16 #include "platform/heap/Handle.h"
17
18 namespace blink {
19
20 class V8TestInterfaceDocument {
21 public:
22     static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
23     static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
24     static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
25     static TestInterfaceDocument* toNative(v8::Handle<v8::Object> object)
26     {
27         return fromInternalPointer(blink::toInternalPointer(object));
28     }
29     static TestInterfaceDocument* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
30     static const WrapperTypeInfo wrapperTypeInfo;
31     static void derefObject(ScriptWrappableBase* internalPointer);
32     static EventTarget* toEventTarget(v8::Handle<v8::Object>);
33 #if ENABLE(OILPAN)
34     static const int persistentHandleIndex = v8DefaultWrapperInternalFieldCount + 0;
35     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0 + 1;
36 #else
37     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
38 #endif
39     static inline ScriptWrappableBase* toInternalPointer(TestInterfaceDocument* impl)
40     {
41         return V8Document::toInternalPointer(impl);
42     }
43
44     static inline TestInterfaceDocument* fromInternalPointer(ScriptWrappableBase* internalPointer)
45     {
46         return static_cast<TestInterfaceDocument*>(V8Document::fromInternalPointer(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(TestInterfaceDocument*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
53     static v8::Handle<v8::Object> createWrapper(PassRefPtrWillBeRawPtr<TestInterfaceDocument>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
54 };
55
56 v8::Handle<v8::Object> wrap(TestInterfaceDocument* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
57
58 inline v8::Handle<v8::Value> toV8(TestInterfaceDocument* 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<V8TestInterfaceDocument>(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, TestInterfaceDocument* impl)
70 {
71     if (UNLIKELY(!impl)) {
72         v8SetReturnValueNull(callbackInfo);
73         return;
74     }
75     if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceDocument>(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, TestInterfaceDocument* impl)
83 {
84     ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
85     if (UNLIKELY(!impl)) {
86         v8SetReturnValueNull(callbackInfo);
87         return;
88     }
89     if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceDocument>(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, TestInterfaceDocument* impl, Wrappable* wrappable)
97 {
98     if (UNLIKELY(!impl)) {
99         v8SetReturnValueNull(callbackInfo);
100         return;
101     }
102     if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceDocument>(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(PassRefPtrWillBeRawPtr<TestInterfaceDocument> 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, PassRefPtrWillBeRawPtr<TestInterfaceDocument> impl)
115 {
116     v8SetReturnValue(callbackInfo, impl.get());
117 }
118
119 template<class CallbackInfo>
120 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceDocument> impl)
121 {
122     v8SetReturnValueForMainWorld(callbackInfo, impl.get());
123 }
124
125 template<class CallbackInfo, class Wrappable>
126 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtrWillBeRawPtr<TestInterfaceDocument> impl, Wrappable* wrappable)
127 {
128     v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
129 }
130
131 }
132 #endif // V8TestInterfaceDocument_h