Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObserverController.h

Issue 1780163002: Revert of IntersectionObserver: use an idle callback to send notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ActiveDOMObject.h" 8 #include "core/dom/ActiveDOMObject.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/IdleRequestCallback.h"
11 #include "core/dom/IntersectionObserver.h" 10 #include "core/dom/IntersectionObserver.h"
11 #include "platform/Timer.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "wtf/HashSet.h" 13 #include "wtf/HashSet.h"
14 14
15 // Design doc for IntersectionObserver implementation: 15 // Design doc for IntersectionObserver implementation:
16 // https://docs.google.com/a/google.com/document/d/1hLK0eyT5_BzyNS4OkjsnoqqFQD YCbKfyBinj94OnLiQ 16 // https://docs.google.com/a/google.com/document/d/1hLK0eyT5_BzyNS4OkjsnoqqFQD YCbKfyBinj94OnLiQ
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class IntersectionObserverController : public IdleRequestCallback, public Active DOMObject { 20 class IntersectionObserverController : public GarbageCollectedFinalized<Intersec tionObserverController>, public ActiveDOMObject {
21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IntersectionObserverController); 21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IntersectionObserverController);
22 public: 22 public:
23 static IntersectionObserverController* create(Document*); 23 static IntersectionObserverController* create(Document*);
24 ~IntersectionObserverController(); 24 ~IntersectionObserverController();
25 25
26 void resume() override; 26 void resume() override;
27 void handleEvent(IdleDeadline*) override;
28 27
29 void scheduleIntersectionObserverForDelivery(IntersectionObserver&); 28 void scheduleIntersectionObserverForDelivery(IntersectionObserver&);
30 void deliverIntersectionObservations(); 29 void deliverIntersectionObservations(Timer<IntersectionObserverController>*) ;
31 void computeTrackedIntersectionObservations(); 30 void computeTrackedIntersectionObservations();
32 void addTrackedObserver(IntersectionObserver&); 31 void addTrackedObserver(IntersectionObserver&);
33 void removeTrackedObserversForRoot(const Node&); 32 void removeTrackedObserversForRoot(const Node&);
34 33
35 DECLARE_TRACE(); 34 DECLARE_TRACE();
36 35
37 private: 36 private:
38 explicit IntersectionObserverController(Document*); 37 explicit IntersectionObserverController(Document*);
39 38
40 private: 39 private:
40 Timer<IntersectionObserverController> m_timer;
41 // IntersectionObservers for which this is the tracking document. 41 // IntersectionObservers for which this is the tracking document.
42 HeapHashSet<WeakMember<IntersectionObserver>> m_trackedIntersectionObservers ; 42 HeapHashSet<WeakMember<IntersectionObserver>> m_trackedIntersectionObservers ;
43 // IntersectionObservers for which this is the execution context of the call back. 43 // IntersectionObservers for which this is the execution context of the call back.
44 HeapHashSet<Member<IntersectionObserver>> m_pendingIntersectionObservers; 44 HeapHashSet<Member<IntersectionObserver>> m_pendingIntersectionObservers;
45 45
46 bool m_callbackIsScheduled; 46 bool m_timerFiredWhileSuspended;
47 bool m_callbackFiredWhileSuspended;
48 }; 47 };
49 48
50 } // namespace blink 49 } // namespace blink
51 50
52 #endif // IntersectionObserverController_h 51 #endif // IntersectionObserverController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698