1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
32
33 #ifndef V8TestInterfaceCheckSecurity_h
34 #define V8TestInterfaceCheckSecurity_h
35
36 #include "bindings/tests/idls/TestInterfaceCheckSecurity.h"
37 #include "bindings/v8/V8Binding.h"
38 #include "bindings/v8/V8DOMWrapper.h"
39 #include "bindings/v8/WrapperTypeInfo.h"
40
41 namespace WebCore {
42
43 class V8TestInterfaceCheckSecurity {
44 public:
45 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldType);
46 static bool hasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
47 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*, WrapperWorldType);
toNative(v8::Handle<v8::Object> object)48 static TestInterfaceCheckSecurity* toNative(v8::Handle<v8::Object> object)
49 {
50 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
51 }
52 static void derefObject(void*);
53 static const WrapperTypeInfo wrapperTypeInfo;
54 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
toInternalPointer(TestInterfaceCheckSecurity * impl)55 static inline void* toInternalPointer(TestInterfaceCheckSecurity* impl)
56 {
57 return impl;
58 }
59
fromInternalPointer(void * object)60 static inline TestInterfaceCheckSecurity* fromInternalPointer(void* object)
61 {
62 return static_cast<TestInterfaceCheckSecurity*>(object);
63 }
installPerContextEnabledProperties(v8::Handle<v8::Object>,TestInterfaceCheckSecurity *,v8::Isolate *)64 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestInterfaceCheckSecurity*, v8::Isolate*) { }
installPerContextEnabledMethods(v8::Handle<v8::Object>,v8::Isolate *)65 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
66
67 private:
68 friend v8::Handle<v8::Object> wrap(TestInterfaceCheckSecurity*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
69 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterfaceCheckSecurity>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
70 };
71
72 template<>
73 class WrapperTypeTraits<TestInterfaceCheckSecurity > {
74 public:
wrapperTypeInfo()75 static const WrapperTypeInfo* wrapperTypeInfo() { return &V8TestInterfaceCheckSecurity::wrapperTypeInfo; }
76 };
77
wrap(TestInterfaceCheckSecurity * impl,v8::Handle<v8::Object> creationContext,v8::Isolate * isolate)78 inline v8::Handle<v8::Object> wrap(TestInterfaceCheckSecurity* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
79 {
80 ASSERT(impl);
81 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceCheckSecurity>(impl, isolate));
82 return V8TestInterfaceCheckSecurity::createWrapper(impl, creationContext, isolate);
83 }
84
toV8(TestInterfaceCheckSecurity * impl,v8::Handle<v8::Object> creationContext,v8::Isolate * isolate)85 inline v8::Handle<v8::Value> toV8(TestInterfaceCheckSecurity* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
86 {
87 if (UNLIKELY(!impl))
88 return v8::Null(isolate);
89 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceCheckSecurity>(impl, isolate);
90 if (!wrapper.IsEmpty())
91 return wrapper;
92 return wrap(impl, creationContext, isolate);
93 }
94
95 template<typename CallbackInfo>
v8SetReturnValue(const CallbackInfo & callbackInfo,TestInterfaceCheckSecurity * impl)96 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceCheckSecurity* impl)
97 {
98 if (UNLIKELY(!impl)) {
99 v8SetReturnValueNull(callbackInfo);
100 return;
101 }
102 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceCheckSecurity>(callbackInfo.GetReturnValue(), impl))
103 return;
104 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
105 v8SetReturnValue(callbackInfo, wrapper);
106 }
107
108 template<typename CallbackInfo>
v8SetReturnValueForMainWorld(const CallbackInfo & callbackInfo,TestInterfaceCheckSecurity * impl)109 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestInterfaceCheckSecurity* impl)
110 {
111 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
112 if (UNLIKELY(!impl)) {
113 v8SetReturnValueNull(callbackInfo);
114 return;
115 }
116 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterfaceCheckSecurity>(callbackInfo.GetReturnValue(), impl))
117 return;
118 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
119 v8SetReturnValue(callbackInfo, wrapper);
120 }
121
122 template<class CallbackInfo, class Wrappable>
v8SetReturnValueFast(const CallbackInfo & callbackInfo,TestInterfaceCheckSecurity * impl,Wrappable * wrappable)123 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterfaceCheckSecurity* impl, Wrappable* wrappable)
124 {
125 if (UNLIKELY(!impl)) {
126 v8SetReturnValueNull(callbackInfo);
127 return;
128 }
129 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterfaceCheckSecurity>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
130 return;
131 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
132 v8SetReturnValue(callbackInfo, wrapper);
133 }
134
toV8(PassRefPtr<TestInterfaceCheckSecurity> impl,v8::Handle<v8::Object> creationContext,v8::Isolate * isolate)135 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterfaceCheckSecurity > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
136 {
137 return toV8(impl.get(), creationContext, isolate);
138 }
139
140 template<class CallbackInfo>
v8SetReturnValue(const CallbackInfo & callbackInfo,PassRefPtr<TestInterfaceCheckSecurity> impl)141 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceCheckSecurity > impl)
142 {
143 v8SetReturnValue(callbackInfo, impl.get());
144 }
145
146 template<class CallbackInfo>
v8SetReturnValueForMainWorld(const CallbackInfo & callbackInfo,PassRefPtr<TestInterfaceCheckSecurity> impl)147 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceCheckSecurity > impl)
148 {
149 v8SetReturnValueForMainWorld(callbackInfo, impl.get());
150 }
151
152 template<class CallbackInfo, class Wrappable>
v8SetReturnValueFast(const CallbackInfo & callbackInfo,PassRefPtr<TestInterfaceCheckSecurity> impl,Wrappable * wrappable)153 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<TestInterfaceCheckSecurity > impl, Wrappable* wrappable)
154 {
155 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
156 }
157
158 }
159 #endif // V8TestInterfaceCheckSecurity_h
160