| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "V8TestCallbackInterface.h" | 8 #include "V8TestCallbackInterface.h" |
| 9 | 9 |
| 10 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" | 10 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" |
| 11 #include "bindings/tests/v8/V8TestInterfaceWillBeGarbageCollected.h" | 11 #include "bindings/tests/v8/V8TestInterfaceWillBeGarbageCollected.h" |
| 12 #include "bindings/v8/ScriptController.h" |
| 12 #include "bindings/v8/V8Binding.h" | 13 #include "bindings/v8/V8Binding.h" |
| 13 #include "core/dom/ExecutionContext.h" | 14 #include "core/dom/ExecutionContext.h" |
| 14 #include "wtf/Assertions.h" | 15 #include "wtf/Assertions.h" |
| 15 #include "wtf/GetPtr.h" | 16 #include "wtf/GetPtr.h" |
| 16 #include "wtf/RefPtr.h" | 17 #include "wtf/RefPtr.h" |
| 17 | 18 |
| 18 namespace WebCore { | 19 namespace WebCore { |
| 19 | 20 |
| 20 V8TestCallbackInterface::V8TestCallbackInterface(v8::Handle<v8::Function> callba
ck, ScriptState* scriptState) | 21 V8TestCallbackInterface::V8TestCallbackInterface(v8::Handle<v8::Function> callba
ck, ScriptState* scriptState) |
| 21 : ActiveDOMCallback(scriptState->executionContext()) | 22 : ActiveDOMCallback(scriptState->executionContext()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 if (!canInvokeCallback()) | 34 if (!canInvokeCallback()) |
| 34 return; | 35 return; |
| 35 | 36 |
| 36 v8::Isolate* isolate = m_scriptState->isolate(); | 37 v8::Isolate* isolate = m_scriptState->isolate(); |
| 37 if (m_scriptState->contextIsEmpty()) | 38 if (m_scriptState->contextIsEmpty()) |
| 38 return; | 39 return; |
| 39 | 40 |
| 40 ScriptState::Scope scope(m_scriptState.get()); | 41 ScriptState::Scope scope(m_scriptState.get()); |
| 41 v8::Handle<v8::Value> *argv = 0; | 42 v8::Handle<v8::Value> *argv = 0; |
| 42 | 43 |
| 43 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 0, argv); | 44 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 0, argv, m_scriptState->
isolate()); |
| 44 } | 45 } |
| 45 | 46 |
| 46 bool V8TestCallbackInterface::booleanMethod() | 47 bool V8TestCallbackInterface::booleanMethod() |
| 47 { | 48 { |
| 48 if (!canInvokeCallback()) | 49 if (!canInvokeCallback()) |
| 49 return true; | 50 return true; |
| 50 | 51 |
| 51 v8::Isolate* isolate = m_scriptState->isolate(); | 52 v8::Isolate* isolate = m_scriptState->isolate(); |
| 52 if (m_scriptState->contextIsEmpty()) | 53 if (m_scriptState->contextIsEmpty()) |
| 53 return true; | 54 return true; |
| 54 | 55 |
| 55 ScriptState::Scope scope(m_scriptState.get()); | 56 ScriptState::Scope scope(m_scriptState.get()); |
| 56 v8::Handle<v8::Value> *argv = 0; | 57 v8::Handle<v8::Value> *argv = 0; |
| 57 | 58 |
| 58 return invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 0,
argv); | 59 v8::TryCatch exceptionCatcher; |
| 60 exceptionCatcher.SetVerbose(true); |
| 61 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 0, argv, m_scriptState->
isolate()); |
| 62 return !exceptionCatcher.HasCaught(); |
| 59 } | 63 } |
| 60 | 64 |
| 61 void V8TestCallbackInterface::voidMethodBooleanArg(bool boolArg) | 65 void V8TestCallbackInterface::voidMethodBooleanArg(bool boolArg) |
| 62 { | 66 { |
| 63 if (!canInvokeCallback()) | 67 if (!canInvokeCallback()) |
| 64 return; | 68 return; |
| 65 | 69 |
| 66 v8::Isolate* isolate = m_scriptState->isolate(); | 70 v8::Isolate* isolate = m_scriptState->isolate(); |
| 67 if (m_scriptState->contextIsEmpty()) | 71 if (m_scriptState->contextIsEmpty()) |
| 68 return; | 72 return; |
| 69 | 73 |
| 70 ScriptState::Scope scope(m_scriptState.get()); | 74 ScriptState::Scope scope(m_scriptState.get()); |
| 71 v8::Handle<v8::Value> boolArgHandle = v8Boolean(boolArg, isolate); | 75 v8::Handle<v8::Value> boolArgHandle = v8Boolean(boolArg, isolate); |
| 72 if (boolArgHandle.IsEmpty()) { | 76 if (boolArgHandle.IsEmpty()) { |
| 73 if (!isScriptControllerTerminating()) | 77 if (!isScriptControllerTerminating()) |
| 74 CRASH(); | 78 CRASH(); |
| 75 return; | 79 return; |
| 76 } | 80 } |
| 77 v8::Handle<v8::Value> argv[] = { boolArgHandle }; | 81 v8::Handle<v8::Value> argv[] = { boolArgHandle }; |
| 78 | 82 |
| 79 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 1, argv); | 83 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 1, argv, m_scriptState->
isolate()); |
| 80 } | 84 } |
| 81 | 85 |
| 82 void V8TestCallbackInterface::voidMethodSequenceArg(const Vector<RefPtr<TestInte
rfaceEmpty> >& sequenceArg) | 86 void V8TestCallbackInterface::voidMethodSequenceArg(const Vector<RefPtr<TestInte
rfaceEmpty> >& sequenceArg) |
| 83 { | 87 { |
| 84 if (!canInvokeCallback()) | 88 if (!canInvokeCallback()) |
| 85 return; | 89 return; |
| 86 | 90 |
| 87 v8::Isolate* isolate = m_scriptState->isolate(); | 91 v8::Isolate* isolate = m_scriptState->isolate(); |
| 88 if (m_scriptState->contextIsEmpty()) | 92 if (m_scriptState->contextIsEmpty()) |
| 89 return; | 93 return; |
| 90 | 94 |
| 91 ScriptState::Scope scope(m_scriptState.get()); | 95 ScriptState::Scope scope(m_scriptState.get()); |
| 92 v8::Handle<v8::Value> sequenceArgHandle = v8Array(sequenceArg, m_scriptState
->context()->Global(), isolate); | 96 v8::Handle<v8::Value> sequenceArgHandle = v8Array(sequenceArg, m_scriptState
->context()->Global(), isolate); |
| 93 if (sequenceArgHandle.IsEmpty()) { | 97 if (sequenceArgHandle.IsEmpty()) { |
| 94 if (!isScriptControllerTerminating()) | 98 if (!isScriptControllerTerminating()) |
| 95 CRASH(); | 99 CRASH(); |
| 96 return; | 100 return; |
| 97 } | 101 } |
| 98 v8::Handle<v8::Value> argv[] = { sequenceArgHandle }; | 102 v8::Handle<v8::Value> argv[] = { sequenceArgHandle }; |
| 99 | 103 |
| 100 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 1, argv); | 104 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 1, argv, m_scriptState->
isolate()); |
| 101 } | 105 } |
| 102 | 106 |
| 103 void V8TestCallbackInterface::voidMethodFloatArg(float floatArg) | 107 void V8TestCallbackInterface::voidMethodFloatArg(float floatArg) |
| 104 { | 108 { |
| 105 if (!canInvokeCallback()) | 109 if (!canInvokeCallback()) |
| 106 return; | 110 return; |
| 107 | 111 |
| 108 v8::Isolate* isolate = m_scriptState->isolate(); | 112 v8::Isolate* isolate = m_scriptState->isolate(); |
| 109 if (m_scriptState->contextIsEmpty()) | 113 if (m_scriptState->contextIsEmpty()) |
| 110 return; | 114 return; |
| 111 | 115 |
| 112 ScriptState::Scope scope(m_scriptState.get()); | 116 ScriptState::Scope scope(m_scriptState.get()); |
| 113 v8::Handle<v8::Value> floatArgHandle = v8::Number::New(isolate, floatArg); | 117 v8::Handle<v8::Value> floatArgHandle = v8::Number::New(isolate, floatArg); |
| 114 if (floatArgHandle.IsEmpty()) { | 118 if (floatArgHandle.IsEmpty()) { |
| 115 if (!isScriptControllerTerminating()) | 119 if (!isScriptControllerTerminating()) |
| 116 CRASH(); | 120 CRASH(); |
| 117 return; | 121 return; |
| 118 } | 122 } |
| 119 v8::Handle<v8::Value> argv[] = { floatArgHandle }; | 123 v8::Handle<v8::Value> argv[] = { floatArgHandle }; |
| 120 | 124 |
| 121 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 1, argv); | 125 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 1, argv, m_scriptState->
isolate()); |
| 122 } | 126 } |
| 123 | 127 |
| 124 void V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty
* testInterfaceEmptyArg) | 128 void V8TestCallbackInterface::voidMethodTestInterfaceEmptyArg(TestInterfaceEmpty
* testInterfaceEmptyArg) |
| 125 { | 129 { |
| 126 if (!canInvokeCallback()) | 130 if (!canInvokeCallback()) |
| 127 return; | 131 return; |
| 128 | 132 |
| 129 v8::Isolate* isolate = m_scriptState->isolate(); | 133 v8::Isolate* isolate = m_scriptState->isolate(); |
| 130 if (m_scriptState->contextIsEmpty()) | 134 if (m_scriptState->contextIsEmpty()) |
| 131 return; | 135 return; |
| 132 | 136 |
| 133 ScriptState::Scope scope(m_scriptState.get()); | 137 ScriptState::Scope scope(m_scriptState.get()); |
| 134 v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyA
rg, m_scriptState->context()->Global(), isolate); | 138 v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyA
rg, m_scriptState->context()->Global(), isolate); |
| 135 if (testInterfaceEmptyArgHandle.IsEmpty()) { | 139 if (testInterfaceEmptyArgHandle.IsEmpty()) { |
| 136 if (!isScriptControllerTerminating()) | 140 if (!isScriptControllerTerminating()) |
| 137 CRASH(); | 141 CRASH(); |
| 138 return; | 142 return; |
| 139 } | 143 } |
| 140 v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle }; | 144 v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle }; |
| 141 | 145 |
| 142 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 1, argv); | 146 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 1, argv, m_scriptState->
isolate()); |
| 143 } | 147 } |
| 144 | 148 |
| 145 void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfac
eEmpty* testInterfaceEmptyArg, const String& stringArg) | 149 void V8TestCallbackInterface::voidMethodTestInterfaceEmptyStringArg(TestInterfac
eEmpty* testInterfaceEmptyArg, const String& stringArg) |
| 146 { | 150 { |
| 147 if (!canInvokeCallback()) | 151 if (!canInvokeCallback()) |
| 148 return; | 152 return; |
| 149 | 153 |
| 150 v8::Isolate* isolate = m_scriptState->isolate(); | 154 v8::Isolate* isolate = m_scriptState->isolate(); |
| 151 if (m_scriptState->contextIsEmpty()) | 155 if (m_scriptState->contextIsEmpty()) |
| 152 return; | 156 return; |
| 153 | 157 |
| 154 ScriptState::Scope scope(m_scriptState.get()); | 158 ScriptState::Scope scope(m_scriptState.get()); |
| 155 v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyA
rg, m_scriptState->context()->Global(), isolate); | 159 v8::Handle<v8::Value> testInterfaceEmptyArgHandle = toV8(testInterfaceEmptyA
rg, m_scriptState->context()->Global(), isolate); |
| 156 if (testInterfaceEmptyArgHandle.IsEmpty()) { | 160 if (testInterfaceEmptyArgHandle.IsEmpty()) { |
| 157 if (!isScriptControllerTerminating()) | 161 if (!isScriptControllerTerminating()) |
| 158 CRASH(); | 162 CRASH(); |
| 159 return; | 163 return; |
| 160 } | 164 } |
| 161 v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg); | 165 v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg); |
| 162 if (stringArgHandle.IsEmpty()) { | 166 if (stringArgHandle.IsEmpty()) { |
| 163 if (!isScriptControllerTerminating()) | 167 if (!isScriptControllerTerminating()) |
| 164 CRASH(); | 168 CRASH(); |
| 165 return; | 169 return; |
| 166 } | 170 } |
| 167 v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle, stringArgHandl
e }; | 171 v8::Handle<v8::Value> argv[] = { testInterfaceEmptyArgHandle, stringArgHandl
e }; |
| 168 | 172 |
| 169 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 2, argv); | 173 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 2, argv, m_scriptState->
isolate()); |
| 170 } | 174 } |
| 171 | 175 |
| 172 void V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptVal
ue thisValue, const String& stringArg) | 176 void V8TestCallbackInterface::callbackWithThisValueVoidMethodStringArg(ScriptVal
ue thisValue, const String& stringArg) |
| 173 { | 177 { |
| 174 if (!canInvokeCallback()) | 178 if (!canInvokeCallback()) |
| 175 return; | 179 return; |
| 176 | 180 |
| 177 v8::Isolate* isolate = m_scriptState->isolate(); | 181 v8::Isolate* isolate = m_scriptState->isolate(); |
| 178 if (m_scriptState->contextIsEmpty()) | 182 if (m_scriptState->contextIsEmpty()) |
| 179 return; | 183 return; |
| 180 | 184 |
| 181 ScriptState::Scope scope(m_scriptState.get()); | 185 ScriptState::Scope scope(m_scriptState.get()); |
| 182 v8::Handle<v8::Value> thisHandle = thisValue.v8Value(); | 186 v8::Handle<v8::Value> thisHandle = thisValue.v8Value(); |
| 183 if (thisHandle.IsEmpty()) { | 187 if (thisHandle.IsEmpty()) { |
| 184 if (!isScriptControllerTerminating()) | 188 if (!isScriptControllerTerminating()) |
| 185 CRASH(); | 189 CRASH(); |
| 186 return; | 190 return; |
| 187 } | 191 } |
| 188 v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg); | 192 v8::Handle<v8::Value> stringArgHandle = v8String(isolate, stringArg); |
| 189 if (stringArgHandle.IsEmpty()) { | 193 if (stringArgHandle.IsEmpty()) { |
| 190 if (!isScriptControllerTerminating()) | 194 if (!isScriptControllerTerminating()) |
| 191 CRASH(); | 195 CRASH(); |
| 192 return; | 196 return; |
| 193 } | 197 } |
| 194 v8::Handle<v8::Value> argv[] = { stringArgHandle }; | 198 v8::Handle<v8::Value> argv[] = { stringArgHandle }; |
| 195 | 199 |
| 196 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), thisHandle
, 1, argv); | 200 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), thisHandle, 1, argv, m_scriptState->isolate()); |
| 197 } | 201 } |
| 198 | 202 |
| 199 void V8TestCallbackInterface::voidMethodWillBeGarbageCollectedSequenceArg(const
WillBeHeapVector<RefPtrWillBeMember<TestInterfaceWillBeGarbageCollected> >& sequ
enceArg) | 203 void V8TestCallbackInterface::voidMethodWillBeGarbageCollectedSequenceArg(const
WillBeHeapVector<RefPtrWillBeMember<TestInterfaceWillBeGarbageCollected> >& sequ
enceArg) |
| 200 { | 204 { |
| 201 if (!canInvokeCallback()) | 205 if (!canInvokeCallback()) |
| 202 return; | 206 return; |
| 203 | 207 |
| 204 v8::Isolate* isolate = m_scriptState->isolate(); | 208 v8::Isolate* isolate = m_scriptState->isolate(); |
| 205 if (m_scriptState->contextIsEmpty()) | 209 if (m_scriptState->contextIsEmpty()) |
| 206 return; | 210 return; |
| 207 | 211 |
| 208 ScriptState::Scope scope(m_scriptState.get()); | 212 ScriptState::Scope scope(m_scriptState.get()); |
| 209 v8::Handle<v8::Value> sequenceArgHandle = v8Array(sequenceArg, m_scriptState
->context()->Global(), isolate); | 213 v8::Handle<v8::Value> sequenceArgHandle = v8Array(sequenceArg, m_scriptState
->context()->Global(), isolate); |
| 210 if (sequenceArgHandle.IsEmpty()) { | 214 if (sequenceArgHandle.IsEmpty()) { |
| 211 if (!isScriptControllerTerminating()) | 215 if (!isScriptControllerTerminating()) |
| 212 CRASH(); | 216 CRASH(); |
| 213 return; | 217 return; |
| 214 } | 218 } |
| 215 v8::Handle<v8::Value> argv[] = { sequenceArgHandle }; | 219 v8::Handle<v8::Value> argv[] = { sequenceArgHandle }; |
| 216 | 220 |
| 217 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 1, argv); | 221 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 1, argv, m_scriptState->
isolate()); |
| 218 } | 222 } |
| 219 | 223 |
| 220 void V8TestCallbackInterface::voidMethodWillBeGarbageCollectedArrayArg(const Wil
lBeHeapVector<RefPtrWillBeMember<TestInterfaceWillBeGarbageCollected> >& arrayAr
g) | 224 void V8TestCallbackInterface::voidMethodWillBeGarbageCollectedArrayArg(const Wil
lBeHeapVector<RefPtrWillBeMember<TestInterfaceWillBeGarbageCollected> >& arrayAr
g) |
| 221 { | 225 { |
| 222 if (!canInvokeCallback()) | 226 if (!canInvokeCallback()) |
| 223 return; | 227 return; |
| 224 | 228 |
| 225 v8::Isolate* isolate = m_scriptState->isolate(); | 229 v8::Isolate* isolate = m_scriptState->isolate(); |
| 226 if (m_scriptState->contextIsEmpty()) | 230 if (m_scriptState->contextIsEmpty()) |
| 227 return; | 231 return; |
| 228 | 232 |
| 229 ScriptState::Scope scope(m_scriptState.get()); | 233 ScriptState::Scope scope(m_scriptState.get()); |
| 230 v8::Handle<v8::Value> arrayArgHandle = v8Array(arrayArg, m_scriptState->cont
ext()->Global(), isolate); | 234 v8::Handle<v8::Value> arrayArgHandle = v8Array(arrayArg, m_scriptState->cont
ext()->Global(), isolate); |
| 231 if (arrayArgHandle.IsEmpty()) { | 235 if (arrayArgHandle.IsEmpty()) { |
| 232 if (!isScriptControllerTerminating()) | 236 if (!isScriptControllerTerminating()) |
| 233 CRASH(); | 237 CRASH(); |
| 234 return; | 238 return; |
| 235 } | 239 } |
| 236 v8::Handle<v8::Value> argv[] = { arrayArgHandle }; | 240 v8::Handle<v8::Value> argv[] = { arrayArgHandle }; |
| 237 | 241 |
| 238 invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), 1, argv); | 242 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(isolate), m_scriptState->context()->Global(), 1, argv, m_scriptState->
isolate()); |
| 239 } | 243 } |
| 240 | 244 |
| 241 } // namespace WebCore | 245 } // namespace WebCore |
| OLD | NEW |