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

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObservationRegistry.h

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Clarify the tear-down path for observers and observations. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/IntersectionObservationRegistry.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservationRegistry.h b/third_party/WebKit/Source/core/dom/IntersectionObservationRegistry.h
new file mode 100644
index 0000000000000000000000000000000000000000..d2c343c3d6d5530a20787880da0ebf762ca7dd36
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservationRegistry.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IntersectionObservationRegistry_h
+#define IntersectionObservationRegistry_h
+
+#include "core/dom/Element.h"
+#include "core/dom/IntersectionObserver.h"
+#include "platform/Timer.h"
+#include "platform/heap/Handle.h"
+#include "wtf/HashSet.h"
+#include "wtf/RefCounted.h"
+
+namespace blink {
+
+class Document;
+template<typename T> class Timer;
+
+typedef WillBeHeapHashSet<RefPtrWillBeMember<IntersectionObserver>> IntersectionObserverHashSet;
+
+class IntersectionObservationRegistry {
+public:
+ IntersectionObservationRegistry(Timer<Document>&);
+ virtual ~IntersectionObservationRegistry();
+
+ void activateIntersectionObserver(IntersectionObserver&);
+ void resumeSuspendedIntersectionObservers();
+ void deliverIntersectionObservations();
+ void clearIntersectionObservations();
+ void computeIntersectionObservations();
+ void addObservation(IntersectionObservation&);
+ void removeObservation(IntersectionObservation&);
+
+private:
+ Timer<Document>& m_timer;
+ IntersectionObserverHashSet m_activeIntersectionObservers;
+ IntersectionObserverHashSet m_suspendedIntersectionObservers;
+ IntersectionObservation::HashSet m_intersectionObservations;
+};
+
+} // namespace blink
+
+#endif // IntersectionObservationRegistry_h

Powered by Google App Engine
This is Rietveld 408576698