| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 This file is part of the WebKit open source project. | |
| 3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! | |
| 4 | |
| 5 This library is free software; you can redistribute it and/or | |
| 6 modify it under the terms of the GNU Library General Public | |
| 7 License as published by the Free Software Foundation; either | |
| 8 version 2 of the License, or (at your option) any later version. | |
| 9 | |
| 10 This library is distributed in the hope that it will be useful, | |
| 11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 Library General Public License for more details. | |
| 14 | |
| 15 You should have received a copy of the GNU Library General Public License | |
| 16 along with this library; see the file COPYING.LIB. If not, write to | |
| 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 18 Boston, MA 02111-1307, USA. | |
| 19 */ | |
| 20 | |
| 21 #include "config.h" | |
| 22 #if ENABLE(SQL_DATABASE) | |
| 23 #include "V8TestCallback.h" | |
| 24 | |
| 25 #include "ScriptExecutionContext.h" | |
| 26 #include "V8Binding.h" | |
| 27 #include "V8Callback.h" | |
| 28 #include "V8Class1.h" | |
| 29 #include "V8Class2.h" | |
| 30 #include "V8Class8.h" | |
| 31 #include "V8DOMStringList.h" | |
| 32 #include "V8ThisClass.h" | |
| 33 #include <wtf/GetPtr.h> | |
| 34 #include <wtf/RefCounted.h> | |
| 35 #include <wtf/RefPtr.h> | |
| 36 | |
| 37 #include <wtf/Assertions.h> | |
| 38 | |
| 39 namespace WebCore { | |
| 40 | |
| 41 V8TestCallback::V8TestCallback(v8::Handle<v8::Object> callback, ScriptExecutionC
ontext* context) | |
| 42 : ActiveDOMCallback(context) | |
| 43 , m_callback(callback) | |
| 44 , m_worldContext(UseCurrentWorld) | |
| 45 { | |
| 46 } | |
| 47 | |
| 48 V8TestCallback::~V8TestCallback() | |
| 49 { | |
| 50 } | |
| 51 | |
| 52 // Functions | |
| 53 | |
| 54 bool V8TestCallback::callbackWithNoParam() | |
| 55 { | |
| 56 if (!canInvokeCallback()) | |
| 57 return true; | |
| 58 | |
| 59 v8::HandleScope handleScope; | |
| 60 | |
| 61 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
worldContext); | |
| 62 if (v8Context.IsEmpty()) | |
| 63 return true; | |
| 64 | |
| 65 v8::Context::Scope scope(v8Context); | |
| 66 | |
| 67 | |
| 68 v8::Handle<v8::Value> *argv = 0; | |
| 69 | |
| 70 bool callbackReturnValue = false; | |
| 71 return !invokeCallback(m_callback.get(), 0, argv, callbackReturnValue, scrip
tExecutionContext()); | |
| 72 } | |
| 73 | |
| 74 bool V8TestCallback::callbackWithClass1Param(Class1* class1Param) | |
| 75 { | |
| 76 if (!canInvokeCallback()) | |
| 77 return true; | |
| 78 | |
| 79 v8::HandleScope handleScope; | |
| 80 | |
| 81 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
worldContext); | |
| 82 if (v8Context.IsEmpty()) | |
| 83 return true; | |
| 84 | |
| 85 v8::Context::Scope scope(v8Context); | |
| 86 | |
| 87 v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param, v8::Handle<v8::O
bject>(), v8Context->GetIsolate()); | |
| 88 if (class1ParamHandle.IsEmpty()) { | |
| 89 if (!isScriptControllerTerminating()) | |
| 90 CRASH(); | |
| 91 return true; | |
| 92 } | |
| 93 | |
| 94 v8::Handle<v8::Value> argv[] = { | |
| 95 class1ParamHandle | |
| 96 }; | |
| 97 | |
| 98 bool callbackReturnValue = false; | |
| 99 return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scrip
tExecutionContext()); | |
| 100 } | |
| 101 | |
| 102 bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String&
strArg) | |
| 103 { | |
| 104 if (!canInvokeCallback()) | |
| 105 return true; | |
| 106 | |
| 107 v8::HandleScope handleScope; | |
| 108 | |
| 109 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
worldContext); | |
| 110 if (v8Context.IsEmpty()) | |
| 111 return true; | |
| 112 | |
| 113 v8::Context::Scope scope(v8Context); | |
| 114 | |
| 115 v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param, v8::Handle<v8::O
bject>(), v8Context->GetIsolate()); | |
| 116 if (class2ParamHandle.IsEmpty()) { | |
| 117 if (!isScriptControllerTerminating()) | |
| 118 CRASH(); | |
| 119 return true; | |
| 120 } | |
| 121 v8::Handle<v8::Value> strArgHandle = v8String(strArg, v8Context->GetIsolate(
)); | |
| 122 if (strArgHandle.IsEmpty()) { | |
| 123 if (!isScriptControllerTerminating()) | |
| 124 CRASH(); | |
| 125 return true; | |
| 126 } | |
| 127 | |
| 128 v8::Handle<v8::Value> argv[] = { | |
| 129 class2ParamHandle, | |
| 130 strArgHandle | |
| 131 }; | |
| 132 | |
| 133 bool callbackReturnValue = false; | |
| 134 return !invokeCallback(m_callback.get(), 2, argv, callbackReturnValue, scrip
tExecutionContext()); | |
| 135 } | |
| 136 | |
| 137 bool V8TestCallback::callbackWithStringList(RefPtr<DOMStringList> listParam) | |
| 138 { | |
| 139 if (!canInvokeCallback()) | |
| 140 return true; | |
| 141 | |
| 142 v8::HandleScope handleScope; | |
| 143 | |
| 144 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
worldContext); | |
| 145 if (v8Context.IsEmpty()) | |
| 146 return true; | |
| 147 | |
| 148 v8::Context::Scope scope(v8Context); | |
| 149 | |
| 150 v8::Handle<v8::Value> listParamHandle = toV8(listParam, v8::Handle<v8::Objec
t>(), v8Context->GetIsolate()); | |
| 151 if (listParamHandle.IsEmpty()) { | |
| 152 if (!isScriptControllerTerminating()) | |
| 153 CRASH(); | |
| 154 return true; | |
| 155 } | |
| 156 | |
| 157 v8::Handle<v8::Value> argv[] = { | |
| 158 listParamHandle | |
| 159 }; | |
| 160 | |
| 161 bool callbackReturnValue = false; | |
| 162 return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scrip
tExecutionContext()); | |
| 163 } | |
| 164 | |
| 165 bool V8TestCallback::callbackWithBoolean(bool boolParam) | |
| 166 { | |
| 167 if (!canInvokeCallback()) | |
| 168 return true; | |
| 169 | |
| 170 v8::HandleScope handleScope; | |
| 171 | |
| 172 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
worldContext); | |
| 173 if (v8Context.IsEmpty()) | |
| 174 return true; | |
| 175 | |
| 176 v8::Context::Scope scope(v8Context); | |
| 177 | |
| 178 v8::Handle<v8::Value> boolParamHandle = v8Boolean(boolParam, v8Context->GetI
solate()); | |
| 179 if (boolParamHandle.IsEmpty()) { | |
| 180 if (!isScriptControllerTerminating()) | |
| 181 CRASH(); | |
| 182 return true; | |
| 183 } | |
| 184 | |
| 185 v8::Handle<v8::Value> argv[] = { | |
| 186 boolParamHandle | |
| 187 }; | |
| 188 | |
| 189 bool callbackReturnValue = false; | |
| 190 return !invokeCallback(m_callback.get(), 1, argv, callbackReturnValue, scrip
tExecutionContext()); | |
| 191 } | |
| 192 | |
| 193 bool V8TestCallback::callbackRequiresThisToPass(Class8* class8Param, ThisClass*
thisClassParam) | |
| 194 { | |
| 195 ASSERT(thisClassParam); | |
| 196 | |
| 197 if (!canInvokeCallback()) | |
| 198 return true; | |
| 199 | |
| 200 v8::HandleScope handleScope; | |
| 201 | |
| 202 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
worldContext); | |
| 203 if (v8Context.IsEmpty()) | |
| 204 return true; | |
| 205 | |
| 206 v8::Context::Scope scope(v8Context); | |
| 207 | |
| 208 v8::Handle<v8::Value> class8ParamHandle = toV8(class8Param, v8::Handle<v8::O
bject>(), v8Context->GetIsolate()); | |
| 209 if (class8ParamHandle.IsEmpty()) { | |
| 210 if (!isScriptControllerTerminating()) | |
| 211 CRASH(); | |
| 212 return true; | |
| 213 } | |
| 214 v8::Handle<v8::Value> thisClassParamHandle = toV8(thisClassParam, v8::Handle
<v8::Object>(), v8Context->GetIsolate()); | |
| 215 if (thisClassParamHandle.IsEmpty()) { | |
| 216 if (!isScriptControllerTerminating()) | |
| 217 CRASH(); | |
| 218 return true; | |
| 219 } | |
| 220 | |
| 221 v8::Handle<v8::Value> argv[] = { | |
| 222 class8ParamHandle, | |
| 223 thisClassParamHandle | |
| 224 }; | |
| 225 | |
| 226 bool callbackReturnValue = false; | |
| 227 return !invokeCallback(m_callback.get(), v8::Handle<v8::Object>::Cast(thisCl
assParamHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); | |
| 228 } | |
| 229 | |
| 230 } // namespace WebCore | |
| 231 | |
| 232 #endif // ENABLE(SQL_DATABASE) | |
| OLD | NEW |