| OLD | NEW |
| (Empty) |
| 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 // clang-format off | |
| 8 | |
| 9 #include "V8VoidCallbackFunctionModules.h" | |
| 10 | |
| 11 #include "bindings/core/v8/ScriptState.h" | |
| 12 #include "bindings/core/v8/ToV8.h" | |
| 13 #include "bindings/core/v8/V8Binding.h" | |
| 14 #include "core/dom/ExecutionContext.h" | |
| 15 #include "wtf/Assertions.h" | |
| 16 | |
| 17 namespace blink { | |
| 18 | |
| 19 V8VoidCallbackFunctionModules::V8VoidCallbackFunctionModules(v8::Isolate* isolat
e, v8::Local<v8::Function> callback) | |
| 20 : m_callback(isolate, callback) | |
| 21 { | |
| 22 DCHECK(!m_callback.isEmpty()); | |
| 23 m_callback.setPhantom(); | |
| 24 } | |
| 25 | |
| 26 DEFINE_TRACE(V8VoidCallbackFunctionModules) | |
| 27 { | |
| 28 } | |
| 29 | |
| 30 bool V8VoidCallbackFunctionModules::call(ScriptState* scriptState, ScriptWrappab
le* scriptWrappable, ExceptionState& exceptionState) | |
| 31 { | |
| 32 if (!scriptState->contextIsValid()) | |
| 33 return false; | |
| 34 | |
| 35 ExecutionContext* context = scriptState->getExecutionContext(); | |
| 36 DCHECK(context); | |
| 37 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreS
topped()) | |
| 38 return false; | |
| 39 | |
| 40 if (m_callback.isEmpty()) | |
| 41 return false; | |
| 42 | |
| 43 ScriptState::Scope scope(scriptState); | |
| 44 | |
| 45 v8::Local<v8::Value> thisValue = toV8(scriptWrappable, scriptState->context(
)->Global(), scriptState->isolate()); | |
| 46 | |
| 47 v8::Local<v8::Value> *argv = nullptr; | |
| 48 | |
| 49 v8::Local<v8::Value> v8ReturnValue; | |
| 50 v8::TryCatch exceptionCatcher(scriptState->isolate()); | |
| 51 exceptionCatcher.SetVerbose(true); | |
| 52 | |
| 53 if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate())
, scriptState->getExecutionContext(), thisValue, 0, argv, scriptState->isolate()
).ToLocal(&v8ReturnValue)) | |
| 54 { | |
| 55 return true; | |
| 56 } | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 } // namespace blink | |
| OLD | NEW |