| 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 if (!canInvokeCallback()) | 31 if (!canInvokeCallback()) |
| 32 return; | 32 return; |
| 33 | 33 |
| 34 if (!m_scriptState->contextIsValid()) | 34 if (!m_scriptState->contextIsValid()) |
| 35 return; | 35 return; |
| 36 ScriptState::Scope scope(m_scriptState.get()); | 36 ScriptState::Scope scope(m_scriptState.get()); |
| 37 | 37 |
| 38 if (m_callback.isEmpty()) | 38 if (m_callback.isEmpty()) |
| 39 return; | 39 return; |
| 40 v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context
()->Global(), m_scriptState->isolate()); | 40 v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context
()->Global(), m_scriptState->isolate()); |
| 41 if (observerHandle.IsEmpty()) { | |
| 42 if (!isScriptControllerTerminating()) | |
| 43 CRASH(); | |
| 44 return; | |
| 45 } | |
| 46 | |
| 47 if (!observerHandle->IsObject()) | 41 if (!observerHandle->IsObject()) |
| 48 return; | 42 return; |
| 49 | 43 |
| 50 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); | 44 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); |
| 51 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()-
>Global(), m_scriptState->isolate()); | 45 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()-
>Global(), m_scriptState->isolate()); |
| 52 if (entriesHandle.IsEmpty()) { | 46 if (entriesHandle.IsEmpty()) { |
| 53 return; | 47 return; |
| 54 } | 48 } |
| 55 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; | 49 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; |
| 56 | 50 |
| 57 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); | 51 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); |
| 58 exceptionCatcher.SetVerbose(true); | 52 exceptionCatcher.SetVerbose(true); |
| 59 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()),
m_scriptState->getExecutionContext(), thisObject, 2, argv, m_scriptState->isolat
e()); | 53 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()),
m_scriptState->getExecutionContext(), thisObject, 2, argv, m_scriptState->isolat
e()); |
| 60 } | 54 } |
| 61 | 55 |
| 62 DEFINE_TRACE(V8IntersectionObserverCallback) | 56 DEFINE_TRACE(V8IntersectionObserverCallback) |
| 63 { | 57 { |
| 64 IntersectionObserverCallback::trace(visitor); | 58 IntersectionObserverCallback::trace(visitor); |
| 65 ActiveDOMCallback::trace(visitor); | 59 ActiveDOMCallback::trace(visitor); |
| 66 } | 60 } |
| 67 | 61 |
| 68 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |