| 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" |
| 11 #include "core/dom/ExecutionContext.h" | 11 #include "core/dom/ExecutionContext.h" |
| 12 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 V8IntersectionObserverCallback::V8IntersectionObserverCallback( | 16 V8IntersectionObserverCallback::V8IntersectionObserverCallback( |
| 17 v8::Local<v8::Function> callback, | 17 v8::Local<v8::Function> callback, |
| 18 v8::Local<v8::Object> owner, | 18 v8::Local<v8::Object> owner, |
| 19 ScriptState* scriptState) | 19 ScriptState* scriptState) |
| 20 : m_callback(scriptState->isolate(), callback), m_scriptState(scriptState) { | 20 : m_callback(scriptState->isolate(), callback), m_scriptState(scriptState) { |
| 21 V8PrivateProperty::getIntersectionObserverCallback(scriptState->isolate()) | 21 V8PrivateProperty::getIntersectionObserverCallback(scriptState->isolate()) |
| 22 .set(scriptState->context(), owner, callback); | 22 .set(owner, callback); |
| 23 m_callback.setPhantom(); | 23 m_callback.setPhantom(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 V8IntersectionObserverCallback::~V8IntersectionObserverCallback() {} | 26 V8IntersectionObserverCallback::~V8IntersectionObserverCallback() {} |
| 27 | 27 |
| 28 void V8IntersectionObserverCallback::handleEvent( | 28 void V8IntersectionObserverCallback::handleEvent( |
| 29 const HeapVector<Member<IntersectionObserverEntry>>& entries, | 29 const HeapVector<Member<IntersectionObserverEntry>>& entries, |
| 30 IntersectionObserver& observer) { | 30 IntersectionObserver& observer) { |
| 31 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); | 31 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
| 32 if (!executionContext || executionContext->isContextSuspended() || | 32 if (!executionContext || executionContext->isContextSuspended() || |
| (...skipping 24 matching lines...) Expand all Loading... |
| 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 |