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

Side by Side Diff: Source/core/dom/IntersectionObserver.h

Issue 1330633003: Intersection Observer first draft Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix segfault on null input. Created 5 years, 3 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IntersectionObserver_h
6 #define IntersectionObserver_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/Element.h"
10 #include "core/dom/IntersectionObserverEntry.h"
11 #include "platform/heap/Handle.h"
12 #include "wtf/HashSet.h"
13 #include "wtf/RefCounted.h"
14 #include "wtf/Vector.h"
15
16 namespace blink {
17
18 class ExceptionState;
19 class IntersectionObserverCallback;
20 class IntersectionObserver;
21 class IntersectionObserverInit;
22
23 using IntersectionObserverEntryVector = WillBeHeapVector<RefPtrWillBeMember<Inte rsectionObserverEntry>>;
24 using IntersectionObserverTargetVector = WillBeHeapVector<RefPtrWillBeWeakMember <Element>>;
25
26 class IntersectionObserver final : public RefCountedWillBeGarbageCollectedFinali zed<IntersectionObserver>, public ScriptWrappable {
27 DEFINE_WRAPPERTYPEINFO();
28 friend class Document;
29 public:
30 static PassRefPtrWillBeRawPtr<IntersectionObserver> create(Document*, PassOw nPtrWillBeRawPtr<IntersectionObserverCallback>);
31 static void resumeSuspendedObservers();
32
33 ~IntersectionObserver();
34
35 void observe(Element*, const IntersectionObserverInit&, ExceptionState&);
36 void disconnect();
37 IntersectionObserverEntryVector takeRecords();
38
39 void enqueueIntersectionObserverEntry(PassRefPtrWillBeRawPtr<IntersectionObs erverEntry>);
40
41 // Eagerly finalized as destructor accesses heap object members.
42 EAGERLY_FINALIZE();
43 DECLARE_TRACE();
44
45 private:
46 explicit IntersectionObserver(Document*, PassOwnPtrWillBeRawPtr<Intersection ObserverCallback>);
47 void deliver();
48 bool shouldBeSuspended() const;
49
50 OwnPtrWillBeMember<IntersectionObserverCallback> m_callback;
51 RawPtrWillBeWeakMember<Document> m_document;
52 IntersectionObserverEntryVector m_entries;
53 IntersectionObserverTargetVector m_targets;
54 };
55
56 } // namespace blink
57
58 #endif // IntersectionObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698