| 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 "core/dom/IntersectionObserverController.h" | 5 #include "core/dom/IntersectionObserverController.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/TaskRunnerHelper.h" | 9 #include "core/dom/TaskRunnerHelper.h" |
| 10 #include "platform/instrumentation/tracing/TraceEvent.h" | 10 #include "platform/instrumentation/tracing/TraceEvent.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 postTaskToDeliverObservations(); | 54 postTaskToDeliverObservations(); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 void IntersectionObserverController::deliverIntersectionObservations() { | 58 void IntersectionObserverController::deliverIntersectionObservations() { |
| 59 ExecutionContext* context = getExecutionContext(); | 59 ExecutionContext* context = getExecutionContext(); |
| 60 if (!context) { | 60 if (!context) { |
| 61 m_pendingIntersectionObservers.clear(); | 61 m_pendingIntersectionObservers.clear(); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 if (context->activeDOMObjectsAreSuspended()) { | 64 if (context->isContextSuspended()) { |
| 65 m_callbackFiredWhileSuspended = true; | 65 m_callbackFiredWhileSuspended = true; |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 HeapHashSet<Member<IntersectionObserver>> observers; | 68 HeapHashSet<Member<IntersectionObserver>> observers; |
| 69 m_pendingIntersectionObservers.swap(observers); | 69 m_pendingIntersectionObservers.swap(observers); |
| 70 for (auto& observer : observers) | 70 for (auto& observer : observers) |
| 71 observer->deliver(); | 71 observer->deliver(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void IntersectionObserverController::computeTrackedIntersectionObservations() { | 74 void IntersectionObserverController::computeTrackedIntersectionObservations() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 97 m_trackedIntersectionObservers.removeAll(toRemove); | 97 m_trackedIntersectionObservers.removeAll(toRemove); |
| 98 } | 98 } |
| 99 | 99 |
| 100 DEFINE_TRACE(IntersectionObserverController) { | 100 DEFINE_TRACE(IntersectionObserverController) { |
| 101 visitor->trace(m_trackedIntersectionObservers); | 101 visitor->trace(m_trackedIntersectionObservers); |
| 102 visitor->trace(m_pendingIntersectionObservers); | 102 visitor->trace(m_pendingIntersectionObservers); |
| 103 SuspendableObject::trace(visitor); | 103 SuspendableObject::trace(visitor); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |