| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "bindings/core/v8/V8IntersectionObserverCallback.h" | 5 #include "bindings/core/v8/V8IntersectionObserverCallback.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptController.h" | 7 #include "bindings/core/v8/ScriptController.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/core/v8/V8IntersectionObserver.h" | 9 #include "bindings/core/v8/V8IntersectionObserver.h" |
| 10 #include "bindings/core/v8/V8PrivateProperty.h" | 10 #include "bindings/core/v8/V8PrivateProperty.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); | 31 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
| 32 if (!executionContext || executionContext->isContextSuspended() || | 32 if (!executionContext || executionContext->isContextSuspended() || |
| 33 executionContext->isContextDestroyed()) | 33 executionContext->isContextDestroyed()) |
| 34 return; | 34 return; |
| 35 if (!m_scriptState->contextIsValid()) | 35 if (!m_scriptState->contextIsValid()) |
| 36 return; | 36 return; |
| 37 ScriptState::Scope scope(m_scriptState.get()); | 37 ScriptState::Scope scope(m_scriptState.get()); |
| 38 | 38 |
| 39 if (m_callback.isEmpty()) | 39 if (m_callback.isEmpty()) |
| 40 return; | 40 return; |
| 41 v8::Local<v8::Value> observerHandle = toV8( | 41 v8::Local<v8::Value> observerHandle = ToV8( |
| 42 &observer, m_scriptState->context()->Global(), m_scriptState->isolate()); | 42 &observer, m_scriptState->context()->Global(), m_scriptState->isolate()); |
| 43 if (!observerHandle->IsObject()) | 43 if (!observerHandle->IsObject()) |
| 44 return; | 44 return; |
| 45 | 45 |
| 46 v8::Local<v8::Object> thisObject = | 46 v8::Local<v8::Object> thisObject = |
| 47 v8::Local<v8::Object>::Cast(observerHandle); | 47 v8::Local<v8::Object>::Cast(observerHandle); |
| 48 v8::Local<v8::Value> entriesHandle = toV8( | 48 v8::Local<v8::Value> entriesHandle = ToV8( |
| 49 entries, m_scriptState->context()->Global(), m_scriptState->isolate()); | 49 entries, m_scriptState->context()->Global(), m_scriptState->isolate()); |
| 50 if (entriesHandle.IsEmpty()) { | 50 if (entriesHandle.IsEmpty()) { |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 v8::Local<v8::Value> argv[] = {entriesHandle, observerHandle}; | 53 v8::Local<v8::Value> argv[] = {entriesHandle, observerHandle}; |
| 54 | 54 |
| 55 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); | 55 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); |
| 56 exceptionCatcher.SetVerbose(true); | 56 exceptionCatcher.SetVerbose(true); |
| 57 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), | 57 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), |
| 58 m_scriptState->getExecutionContext(), thisObject, | 58 m_scriptState->getExecutionContext(), thisObject, |
| 59 2, argv, m_scriptState->isolate()); | 59 2, argv, m_scriptState->isolate()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 DEFINE_TRACE(V8IntersectionObserverCallback) { | 62 DEFINE_TRACE(V8IntersectionObserverCallback) { |
| 63 IntersectionObserverCallback::trace(visitor); | 63 IntersectionObserverCallback::trace(visitor); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |