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