| 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 // clang-format off | 7 // clang-format off |
| 8 | 8 |
| 9 #include "VoidCallbackFunctionModules.h" | 9 #include "VoidCallbackFunctionModules.h" |
| 10 | 10 |
| 11 #include "bindings/core/v8/ExceptionState.h" | 11 #include "bindings/core/v8/ExceptionState.h" |
| 12 #include "bindings/core/v8/ScriptState.h" | 12 #include "bindings/core/v8/ScriptState.h" |
| 13 #include "bindings/core/v8/ToV8.h" | 13 #include "bindings/core/v8/ToV8.h" |
| 14 #include "bindings/core/v8/V8Binding.h" | 14 #include "bindings/core/v8/V8Binding.h" |
| 15 #include "core/dom/ExecutionContext.h" | 15 #include "core/dom/ExecutionContext.h" |
| 16 #include "wtf/Assertions.h" | 16 #include "wtf/Assertions.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 VoidCallbackFunctionModules::VoidCallbackFunctionModules(v8::Isolate* isolate, v
8::Local<v8::Function> callback) | 20 VoidCallbackFunctionModules::VoidCallbackFunctionModules(ScriptState* scriptStat
e, v8::Local<v8::Function> callback) |
| 21 : m_callback(isolate, callback) | 21 : m_scriptState(scriptState), |
| 22 m_callback(scriptState->isolate(), callback) |
| 22 { | 23 { |
| 23 DCHECK(!m_callback.isEmpty()); | 24 DCHECK(!m_callback.isEmpty()); |
| 24 m_callback.setPhantom(); | 25 m_callback.setPhantom(); |
| 25 } | 26 } |
| 26 | 27 |
| 27 DEFINE_TRACE(VoidCallbackFunctionModules) | 28 DEFINE_TRACE(VoidCallbackFunctionModules) |
| 28 { | 29 { |
| 29 } | 30 } |
| 30 | 31 |
| 31 DEFINE_TRACE_WRAPPERS(VoidCallbackFunctionModules) | 32 DEFINE_TRACE_WRAPPERS(VoidCallbackFunctionModules) |
| 32 { | 33 { |
| 33 visitor->traceWrappers(&m_callback.cast<v8::Object>()); | 34 visitor->traceWrappers(&m_callback.cast<v8::Object>()); |
| 34 } | 35 } |
| 35 | 36 |
| 36 bool VoidCallbackFunctionModules::call(ScriptState* scriptState, ScriptWrappable
* scriptWrappable) | 37 bool VoidCallbackFunctionModules::call(ScriptWrappable* scriptWrappable) |
| 37 { | 38 { |
| 38 if (!scriptState->contextIsValid()) | 39 if (!m_scriptState->contextIsValid()) |
| 39 return false; | 40 return false; |
| 40 | 41 |
| 41 ExecutionContext* context = scriptState->getExecutionContext(); | 42 ExecutionContext* context = m_scriptState->getExecutionContext(); |
| 42 DCHECK(context); | 43 DCHECK(context); |
| 43 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreS
topped()) | 44 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreS
topped()) |
| 44 return false; | 45 return false; |
| 45 | 46 |
| 46 if (m_callback.isEmpty()) | 47 if (m_callback.isEmpty()) |
| 47 return false; | 48 return false; |
| 48 | 49 |
| 49 // TODO(bashi): Make sure that using TrackExceptionState is OK. | 50 // TODO(bashi): Make sure that using TrackExceptionState is OK. |
| 50 // crbug.com/653769 | 51 // crbug.com/653769 |
| 51 TrackExceptionState exceptionState; | 52 TrackExceptionState exceptionState; |
| 52 ScriptState::Scope scope(scriptState); | 53 ScriptState::Scope scope(m_scriptState.get()); |
| 53 | 54 |
| 54 v8::Local<v8::Value> thisValue = toV8(scriptWrappable, scriptState->context(
)->Global(), scriptState->isolate()); | 55 v8::Local<v8::Value> thisValue = toV8(scriptWrappable, m_scriptState->contex
t()->Global(), m_scriptState->isolate()); |
| 55 | 56 |
| 56 v8::Local<v8::Value> *argv = nullptr; | 57 v8::Local<v8::Value> *argv = nullptr; |
| 57 | 58 |
| 58 v8::Local<v8::Value> v8ReturnValue; | 59 v8::Local<v8::Value> v8ReturnValue; |
| 59 v8::TryCatch exceptionCatcher(scriptState->isolate()); | 60 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); |
| 60 exceptionCatcher.SetVerbose(true); | 61 exceptionCatcher.SetVerbose(true); |
| 61 | 62 |
| 62 if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate())
, scriptState->getExecutionContext(), thisValue, 0, argv, scriptState->isolate()
).ToLocal(&v8ReturnValue)) | 63 if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate(
)), m_scriptState->getExecutionContext(), thisValue, 0, argv, m_scriptState->iso
late()).ToLocal(&v8ReturnValue)) |
| 63 { | 64 { |
| 64 return true; | 65 return true; |
| 65 } | 66 } |
| 66 return false; | 67 return false; |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |