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/ElementIntersectionObserverData.h" | 5 #include "core/dom/ElementIntersectionObserverData.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/IntersectionObservation.h" | 9 #include "core/dom/IntersectionObservation.h" |
10 #include "core/dom/IntersectionObserver.h" | 10 #include "core/dom/IntersectionObserver.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 #if !ENABLE(OILPAN) | 67 #if !ENABLE(OILPAN) |
68 void ElementIntersectionObserverData::dispose() | 68 void ElementIntersectionObserverData::dispose() |
69 { | 69 { |
70 HeapVector<Member<IntersectionObserver>> observersToDisconnect; | 70 HeapVector<Member<IntersectionObserver>> observersToDisconnect; |
71 copyToVector(m_intersectionObservers, observersToDisconnect); | 71 copyToVector(m_intersectionObservers, observersToDisconnect); |
72 for (auto& observer : observersToDisconnect) | 72 for (auto& observer : observersToDisconnect) |
73 observer->disconnect(); | 73 observer->disconnect(); |
74 ASSERT(m_intersectionObservers.isEmpty()); | 74 ASSERT(m_intersectionObservers.isEmpty()); |
75 | |
76 m_weakPointerFactory.clear(); | |
77 } | 75 } |
78 #endif | 76 #endif |
79 | 77 |
80 WeakPtrWillBeRawPtr<Element> ElementIntersectionObserverData::createWeakPtr(Elem
ent* element) | 78 WeakPtrWillBeRawPtr<Element> ElementIntersectionObserverData::createWeakPtr(Elem
ent* element) |
81 { | 79 { |
82 #if ENABLE(OILPAN) | 80 #if ENABLE(OILPAN) |
83 return element; | 81 return element; |
84 #else | 82 #else |
85 if (!m_weakPointerFactory) | 83 if (!m_weakPointerFactory) |
86 m_weakPointerFactory = adoptPtrWillBeNoop(new WeakPtrFactory<Element>(el
ement)); | 84 m_weakPointerFactory = adoptPtrWillBeNoop(new WeakPtrFactory<Element>(el
ement)); |
87 return m_weakPointerFactory->createWeakPtr(); | 85 return m_weakPointerFactory->createWeakPtr(); |
88 #endif | 86 #endif |
89 } | 87 } |
90 | 88 |
91 DEFINE_TRACE(ElementIntersectionObserverData) | 89 DEFINE_TRACE(ElementIntersectionObserverData) |
92 { | 90 { |
93 visitor->trace(m_intersectionObservers); | 91 visitor->trace(m_intersectionObservers); |
94 visitor->trace(m_intersectionObservations); | 92 visitor->trace(m_intersectionObservations); |
95 } | 93 } |
96 | 94 |
97 } // namespace blink | 95 } // namespace blink |
OLD | NEW |