| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |
| 32 | 32 |
| 33 #include "config.h" | 33 #include "config.h" |
| 34 #include "V8TestCallback.h" | 34 #include "V8TestCallbackInterface.h" |
| 35 | 35 |
| 36 #include "V8TestInterfaceEmpty.h" | 36 #include "V8TestInterfaceEmpty.h" |
| 37 #include "bindings/v8/V8Binding.h" | 37 #include "bindings/v8/V8Binding.h" |
| 38 #include "bindings/v8/V8Callback.h" | 38 #include "bindings/v8/V8Callback.h" |
| 39 #include "core/dom/ExecutionContext.h" | 39 #include "core/dom/ExecutionContext.h" |
| 40 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" |
| 41 #include "wtf/GetPtr.h" | 41 #include "wtf/GetPtr.h" |
| 42 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 V8TestCallback::V8TestCallback(v8::Handle<v8::Function> callback, ExecutionConte
xt* context) | 45 V8TestCallbackInterface::V8TestCallbackInterface(v8::Handle<v8::Function> callba
ck, ExecutionContext* context) |
| 46 : ActiveDOMCallback(context) | 46 : ActiveDOMCallback(context) |
| 47 , m_callback(toIsolate(context), callback) | 47 , m_callback(toIsolate(context), callback) |
| 48 , m_world(DOMWrapperWorld::current()) | 48 , m_world(DOMWrapperWorld::current()) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 V8TestCallback::~V8TestCallback() | 52 V8TestCallbackInterface::~V8TestCallbackInterface() |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool V8TestCallback::callbackWithNoArg() | 56 void V8TestCallbackInterface::voidMethod() |
| 57 { | 57 { |
| 58 if (!canInvokeCallback()) | 58 if (!canInvokeCallback()) |
| 59 return true; | 59 return; |
| 60 | 60 |
| 61 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 61 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 62 v8::HandleScope handleScope(isolate); | 62 v8::HandleScope handleScope(isolate); |
| 63 | 63 |
| 64 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 64 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 65 if (v8Context.IsEmpty()) | 65 if (v8Context.IsEmpty()) |
| 66 return true; | 66 return; |
| 67 | 67 |
| 68 v8::Context::Scope scope(v8Context); | 68 v8::Context::Scope scope(v8Context); |
| 69 v8::Handle<v8::Value> *argv = 0; | 69 v8::Handle<v8::Value> *argv = 0; |
| 70 | 70 |
| 71 return invokeCallback(m_callback.newLocal(isolate), 0, argv, executionContex
t(), isolate); | 71 invokeCallback(m_callback.newLocal(isolate), 0, argv, executionContext(), is
olate); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool V8TestCallback::callbackWithTestInterfaceEmptyArg(TestInterfaceEmpty* class
1Arg) | 74 bool V8TestCallbackInterface::booleanMethod() |
| 75 { | 75 { |
| 76 if (!canInvokeCallback()) | 76 if (!canInvokeCallback()) |
| 77 return true; | 77 return true; |
| 78 | 78 |
| 79 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 79 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 80 v8::HandleScope handleScope(isolate); | 80 v8::HandleScope handleScope(isolate); |
| 81 | 81 |
| 82 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 82 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 83 if (v8Context.IsEmpty()) | 83 if (v8Context.IsEmpty()) |
| 84 return true; | 84 return true; |
| 85 | 85 |
| 86 v8::Context::Scope scope(v8Context); | 86 v8::Context::Scope scope(v8Context); |
| 87 v8::Handle<v8::Value> class1ArgHandle = toV8(class1Arg, v8::Handle<v8::Objec
t>(), isolate); | 87 v8::Handle<v8::Value> *argv = 0; |
| 88 if (class1ArgHandle.IsEmpty()) { | |
| 89 if (!isScriptControllerTerminating()) | |
| 90 CRASH(); | |
| 91 return true; | |
| 92 } | |
| 93 v8::Handle<v8::Value> argv[] = { class1ArgHandle }; | |
| 94 | 88 |
| 95 return invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContex
t(), isolate); | 89 return invokeCallback(m_callback.newLocal(isolate), 0, argv, executionContex
t(), isolate); |
| 96 } | 90 } |
| 97 | 91 |
| 98 bool V8TestCallback::callbackWithTestInterfaceEmptyArg(TestInterfaceEmpty* class
2Arg, const String& strArg) | 92 void V8TestCallbackInterface::voidMethodBooleanArg(bool boolArg) |
| 99 { | 93 { |
| 100 if (!canInvokeCallback()) | 94 if (!canInvokeCallback()) |
| 101 return true; | 95 return; |
| 102 | 96 |
| 103 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 97 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 104 v8::HandleScope handleScope(isolate); | 98 v8::HandleScope handleScope(isolate); |
| 105 | 99 |
| 106 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 100 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 107 if (v8Context.IsEmpty()) | 101 if (v8Context.IsEmpty()) |
| 108 return true; | 102 return; |
| 109 | 103 |
| 110 v8::Context::Scope scope(v8Context); | 104 v8::Context::Scope scope(v8Context); |
| 111 v8::Handle<v8::Value> class2ArgHandle = toV8(class2Arg, v8::Handle<v8::Objec
t>(), isolate); | 105 v8::Handle<v8::Value> boolArgHandle = v8Boolean(boolArg, isolate); |
| 112 if (class2ArgHandle.IsEmpty()) { | 106 if (boolArgHandle.IsEmpty()) { |
| 113 if (!isScriptControllerTerminating()) | 107 if (!isScriptControllerTerminating()) |
| 114 CRASH(); | 108 CRASH(); |
| 115 return true; | 109 return; |
| 116 } | 110 } |
| 117 v8::Handle<v8::Value> strArgHandle = v8String(isolate, strArg); | 111 v8::Handle<v8::Value> argv[] = { boolArgHandle }; |
| 118 if (strArgHandle.IsEmpty()) { | |
| 119 if (!isScriptControllerTerminating()) | |
| 120 CRASH(); | |
| 121 return true; | |
| 122 } | |
| 123 v8::Handle<v8::Value> argv[] = { class2ArgHandle, strArgHandle }; | |
| 124 | 112 |
| 125 return invokeCallback(m_callback.newLocal(isolate), 2, argv, executionContex
t(), isolate); | 113 invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContext(), is
olate); |
| 126 } | 114 } |
| 127 | 115 |
| 128 bool V8TestCallback::callbackWithBooleanArg(bool boolArg) | 116 void V8TestCallbackInterface::voidMethodSequenceArg(const Vector<RefPtr<TestInte
rfaceEmpty> >& sequenceArg) |
| 129 { | 117 { |
| 130 if (!canInvokeCallback()) | 118 if (!canInvokeCallback()) |
| 131 return true; | 119 return; |
| 132 | 120 |
| 133 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 121 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 134 v8::HandleScope handleScope(isolate); | 122 v8::HandleScope handleScope(isolate); |
| 135 | 123 |
| 136 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 124 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 137 if (v8Context.IsEmpty()) | 125 if (v8Context.IsEmpty()) |
| 138 return true; | 126 return; |
| 139 | 127 |
| 140 v8::Context::Scope scope(v8Context); | 128 v8::Context::Scope scope(v8Context); |
| 141 v8::Handle<v8::Value> boolArgHandle = v8Boolean(boolArg, isolate); | 129 v8::Handle<v8::Value> sequenceArgHandle = v8Array(sequenceArg, isolate); |
| 142 if (boolArgHandle.IsEmpty()) { | 130 if (sequenceArgHandle.IsEmpty()) { |
| 143 if (!isScriptControllerTerminating()) | 131 if (!isScriptControllerTerminating()) |
| 144 CRASH(); | 132 CRASH(); |
| 145 return true; | 133 return; |
| 146 } | 134 } |
| 147 v8::Handle<v8::Value> argv[] = { boolArgHandle }; | 135 v8::Handle<v8::Value> argv[] = { sequenceArgHandle }; |
| 148 | 136 |
| 149 return invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContex
t(), isolate); | 137 invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContext(), is
olate); |
| 150 } | 138 } |
| 151 | 139 |
| 152 bool V8TestCallback::callbackWithSequenceArg(const Vector<RefPtr<TestInterfaceEm
pty> >& sequenceArg) | 140 void V8TestCallbackInterface::voidMethodFloatArg(float floatArg) |
| 153 { | 141 { |
| 154 if (!canInvokeCallback()) | 142 if (!canInvokeCallback()) |
| 155 return true; | 143 return; |
| 156 | 144 |
| 157 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 145 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 158 v8::HandleScope handleScope(isolate); | 146 v8::HandleScope handleScope(isolate); |
| 159 | 147 |
| 160 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 148 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 161 if (v8Context.IsEmpty()) | 149 if (v8Context.IsEmpty()) |
| 162 return true; | 150 return; |
| 163 | 151 |
| 164 v8::Context::Scope scope(v8Context); | 152 v8::Context::Scope scope(v8Context); |
| 165 v8::Handle<v8::Value> sequenceArgHandle = v8Array(sequenceArg, isolate); | 153 v8::Handle<v8::Value> floatArgHandle = v8::Number::New(isolate, floatArg); |
| 166 if (sequenceArgHandle.IsEmpty()) { | 154 if (floatArgHandle.IsEmpty()) { |
| 167 if (!isScriptControllerTerminating()) | 155 if (!isScriptControllerTerminating()) |
| 168 CRASH(); | 156 CRASH(); |
| 169 return true; | 157 return; |
| 170 } | 158 } |
| 171 v8::Handle<v8::Value> argv[] = { sequenceArgHandle }; | 159 v8::Handle<v8::Value> argv[] = { floatArgHandle }; |
| 172 | 160 |
| 173 return invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContex
t(), isolate); | 161 invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContext(), is
olate); |
| 174 } | 162 } |
| 175 | 163 |
| 176 bool V8TestCallback::callbackWithFloatArg(float floatArg) | 164 void V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty
* testInterfaceEmptyArg) |
| 177 { | 165 { |
| 178 if (!canInvokeCallback()) | 166 if (!canInvokeCallback()) |
| 179 return true; | 167 return; |
| 180 | 168 |
| 181 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 169 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 182 v8::HandleScope handleScope(isolate); | 170 v8::HandleScope handleScope(isolate); |
| 183 | 171 |
| 184 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 172 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 185 if (v8Context.IsEmpty()) | 173 if (v8Context.IsEmpty()) |
| 186 return true; | 174 return; |
| 187 | 175 |
| 188 v8::Context::Scope scope(v8Context); | 176 v8::Context::Scope scope(v8Context); |
| 189 v8::Handle<v8::Value> floatArgHandle = v8::Number::New(isolate, floatArg); | 177 v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyA
rg, v8::Handle<v8::Object>(), isolate); |
| 190 if (floatArgHandle.IsEmpty()) { | 178 if (testInterfaceEmptyArgHandle.IsEmpty()) { |
| 191 if (!isScriptControllerTerminating()) | 179 if (!isScriptControllerTerminating()) |
| 192 CRASH(); | 180 CRASH(); |
| 193 return true; | 181 return; |
| 194 } | 182 } |
| 195 v8::Handle<v8::Value> argv[] = { floatArgHandle }; | 183 v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle }; |
| 196 | 184 |
| 197 return invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContex
t(), isolate); | 185 invokeCallback(m_callback.newLocal(isolate), 1, argv, executionContext(), is
olate); |
| 198 } | 186 } |
| 199 | 187 |
| 200 bool V8TestCallback::callbackWithThisArg(ScriptValue thisValue, int arg) | 188 void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfac
eEmpty* testInterfaceEmptyArg, const String& stringArg) |
| 201 { | 189 { |
| 202 if (!canInvokeCallback()) | 190 if (!canInvokeCallback()) |
| 203 return true; | 191 return; |
| 204 | 192 |
| 205 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 193 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 206 v8::HandleScope handleScope(isolate); | 194 v8::HandleScope handleScope(isolate); |
| 207 | 195 |
| 208 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 196 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 209 if (v8Context.IsEmpty()) | 197 if (v8Context.IsEmpty()) |
| 210 return true; | 198 return; |
| 211 | 199 |
| 212 v8::Context::Scope scope(v8Context); | 200 v8::Context::Scope scope(v8Context); |
| 213 v8::Handle<v8::Value> thisHandle = thisValue.v8Value(); | 201 v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyA
rg, v8::Handle<v8::Object>(), isolate); |
| 214 if (thisHandle.IsEmpty()) { | 202 if (testInterfaceEmptyArgHandle.IsEmpty()) { |
| 215 if (!isScriptControllerTerminating()) | 203 if (!isScriptControllerTerminating()) |
| 216 CRASH(); | 204 CRASH(); |
| 217 return true; | 205 return; |
| 218 } | 206 } |
| 219 ASSERT(thisHandle->IsObject()); | 207 v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg); |
| 220 v8::Handle<v8::Value> argHandle = v8::Integer::New(isolate, arg); | 208 if (stringArgHandle.IsEmpty()) { |
| 221 if (argHandle.IsEmpty()) { | |
| 222 if (!isScriptControllerTerminating()) | 209 if (!isScriptControllerTerminating()) |
| 223 CRASH(); | 210 CRASH(); |
| 224 return true; | 211 return; |
| 225 } | 212 } |
| 226 v8::Handle<v8::Value> argv[] = { argHandle }; | 213 v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle, stringArgHandl
e }; |
| 227 | 214 |
| 228 return invokeCallback(m_callback.newLocal(isolate), v8::Handle<v8::Object>::
Cast(thisHandle), 1, argv, executionContext(), isolate); | 215 invokeCallback(m_callback.newLocal(isolate), 2, argv, executionContext(), is
olate); |
| 229 } | 216 } |
| 230 | 217 |
| 231 void V8TestCallback::callbackWithVoidReturnValue() | 218 void V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptVal
ue thisValue, const String& stringArg) |
| 232 { | 219 { |
| 233 if (!canInvokeCallback()) | 220 if (!canInvokeCallback()) |
| 234 return; | 221 return; |
| 235 | 222 |
| 236 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 223 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 237 v8::HandleScope handleScope(isolate); | 224 v8::HandleScope handleScope(isolate); |
| 238 | 225 |
| 239 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); | 226 v8::Handle<v8::Context> v8Context = toV8Context(executionContext(), m_world.
get()); |
| 240 if (v8Context.IsEmpty()) | 227 if (v8Context.IsEmpty()) |
| 241 return; | 228 return; |
| 242 | 229 |
| 243 v8::Context::Scope scope(v8Context); | 230 v8::Context::Scope scope(v8Context); |
| 244 v8::Handle<v8::Value> *argv = 0; | 231 v8::Handle<v8::Value> thisHandle = thisValue.v8Value(); |
| 232 if (thisHandle.IsEmpty()) { |
| 233 if (!isScriptControllerTerminating()) |
| 234 CRASH(); |
| 235 return; |
| 236 } |
| 237 ASSERT(thisHandle->IsObject()); |
| 238 v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg); |
| 239 if (stringArgHandle.IsEmpty()) { |
| 240 if (!isScriptControllerTerminating()) |
| 241 CRASH(); |
| 242 return; |
| 243 } |
| 244 v8::Handle<v8::Value> argv[] = { stringArgHandle }; |
| 245 | 245 |
| 246 invokeCallback(m_callback.newLocal(isolate), 0, argv, executionContext(), is
olate); | 246 invokeCallback(m_callback.newLocal(isolate), v8::Handle<v8::Object>::Cast(th
isHandle), 1, argv, executionContext(), isolate); |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace WebCore | 249 } // namespace WebCore |
| OLD | NEW |