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 #ifndef IntersectionObserverController_h | 5 #ifndef IntersectionObserverController_h |
6 #define IntersectionObserverController_h | 6 #define IntersectionObserverController_h |
7 | 7 |
8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
9 #include "core/dom/IntersectionObserver.h" | 9 #include "core/dom/IntersectionObserver.h" |
10 #include "platform/Timer.h" | 10 #include "platform/Timer.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/HashSet.h" | 12 #include "wtf/HashSet.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class IntersectionObserverController : public GarbageCollectedFinalized<Intersec
tionObserverController> { | 16 class IntersectionObserverController : public GarbageCollectedFinalized<Intersec
tionObserverController> { |
17 public: | 17 public: |
18 IntersectionObserverController(); | 18 IntersectionObserverController(); |
19 ~IntersectionObserverController(); | 19 ~IntersectionObserverController(); |
20 | 20 |
21 void scheduleIntersectionObserverForDelivery(IntersectionObserver&); | 21 void scheduleIntersectionObserverForDelivery(IntersectionObserver&); |
22 void deliverIntersectionObservations(Timer<IntersectionObserverController>*)
; | 22 void deliverIntersectionObservations(Timer<IntersectionObserverController>*)
; |
23 void computeTrackedIntersectionObservations(); | 23 void computeTrackedIntersectionObservations(); |
24 void addTrackedObserver(IntersectionObserver&); | 24 void addTrackedObserver(IntersectionObserver&); |
25 void removeTrackedObserversForRoot(const Element&); | 25 void removeTrackedObserversForRoot(const Node&); |
26 | 26 |
27 DECLARE_TRACE(); | 27 DECLARE_TRACE(); |
28 | 28 |
29 private: | 29 private: |
30 // Design doc for IntersectionObserver implementation: | 30 // Design doc for IntersectionObserver implementation: |
31 // https://docs.google.com/a/google.com/document/d/1hLK0eyT5_BzyNS4Okjsnoq
qFQDYCbKfyBinj94OnLiQ | 31 // https://docs.google.com/a/google.com/document/d/1hLK0eyT5_BzyNS4Okjsnoq
qFQDYCbKfyBinj94OnLiQ |
32 | 32 |
33 Timer<IntersectionObserverController> m_timer; | 33 Timer<IntersectionObserverController> m_timer; |
34 // IntersectionObservers for which this is the tracking document. | 34 // IntersectionObservers for which this is the tracking document. |
35 HeapHashSet<WeakMember<IntersectionObserver>> m_trackedIntersectionObservers
; | 35 HeapHashSet<WeakMember<IntersectionObserver>> m_trackedIntersectionObservers
; |
36 // IntersectionObservers for which this is the execution context of the call
back. | 36 // IntersectionObservers for which this is the execution context of the call
back. |
37 HeapHashSet<Member<IntersectionObserver>> m_pendingIntersectionObservers; | 37 HeapHashSet<Member<IntersectionObserver>> m_pendingIntersectionObservers; |
38 }; | 38 }; |
39 | 39 |
40 } // namespace blink | 40 } // namespace blink |
41 | 41 |
42 #endif // IntersectionObserverController_h | 42 #endif // IntersectionObserverController_h |
OLD | NEW |