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/NodeIntersectionObserverData.h" | 5 #include "core/dom/NodeIntersectionObserverData.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/IntersectionObservation.h" | 8 #include "core/dom/IntersectionObservation.h" |
9 #include "core/dom/IntersectionObserver.h" | 9 #include "core/dom/IntersectionObserver.h" |
10 #include "core/dom/IntersectionObserverController.h" | 10 #include "core/dom/IntersectionObserverController.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 IntersectionObserverController& controller = node.document().ensureIntersect
ionObserverController(); | 38 IntersectionObserverController& controller = node.document().ensureIntersect
ionObserverController(); |
39 for (auto& observer : m_intersectionObservers) | 39 for (auto& observer : m_intersectionObservers) |
40 controller.addTrackedObserver(*observer); | 40 controller.addTrackedObserver(*observer); |
41 } | 41 } |
42 | 42 |
43 void NodeIntersectionObserverData::deactivateAllIntersectionObservers(Node& node
) | 43 void NodeIntersectionObserverData::deactivateAllIntersectionObservers(Node& node
) |
44 { | 44 { |
45 node.document().ensureIntersectionObserverController().removeTrackedObserver
sForRoot(node); | 45 node.document().ensureIntersectionObserverController().removeTrackedObserver
sForRoot(node); |
46 } | 46 } |
47 | 47 |
48 #if !ENABLE(OILPAN) | |
49 void NodeIntersectionObserverData::dispose() | |
50 { | |
51 HeapVector<Member<IntersectionObserver>> observersToDisconnect; | |
52 copyToVector(m_intersectionObservers, observersToDisconnect); | |
53 for (auto& observer : observersToDisconnect) | |
54 observer->disconnect(); | |
55 DCHECK(m_intersectionObservers.isEmpty()); | |
56 } | |
57 #endif | |
58 | |
59 RawPtr<Node> NodeIntersectionObserverData::createWeakPtr(Node* node) | |
60 { | |
61 #if ENABLE(OILPAN) | |
62 return node; | |
63 #else | |
64 if (!m_weakPointerFactory) | |
65 m_weakPointerFactory = new WeakPtrFactory<Node>(node); | |
66 WeakPtr<Node> result = m_weakPointerFactory->createWeakPtr(); | |
67 DCHECK_EQ(result.get(), node); | |
68 return result; | |
69 #endif | |
70 } | |
71 | |
72 DEFINE_TRACE(NodeIntersectionObserverData) | 48 DEFINE_TRACE(NodeIntersectionObserverData) |
73 { | 49 { |
74 visitor->trace(m_intersectionObservers); | 50 visitor->trace(m_intersectionObservers); |
75 visitor->trace(m_intersectionObservations); | 51 visitor->trace(m_intersectionObservations); |
76 } | 52 } |
77 | 53 |
78 } // namespace blink | 54 } // namespace blink |
OLD | NEW |