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