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

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

Issue 2272773002: Use intersection observer to control frame throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update LeakExpectations Created 4 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 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 ElementVisibilityObserver_h 5 #ifndef ElementVisibilityObserver_h
6 #define ElementVisibilityObserver_h 6 #define ElementVisibilityObserver_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/IntersectionObserver.h" 9 #include "core/dom/IntersectionObserver.h"
10 #include "platform/heap/Heap.h" 10 #include "platform/heap/Heap.h"
(...skipping 18 matching lines...) Expand all
29 29
30 public: 30 public:
31 using VisibilityCallback = Function<void(bool), WTF::SameThreadAffinity>; 31 using VisibilityCallback = Function<void(bool), WTF::SameThreadAffinity>;
32 32
33 ElementVisibilityObserver(Element*, std::unique_ptr<VisibilityCallback>); 33 ElementVisibilityObserver(Element*, std::unique_ptr<VisibilityCallback>);
34 virtual ~ElementVisibilityObserver(); 34 virtual ~ElementVisibilityObserver();
35 35
36 void start(); 36 void start();
37 void stop(); 37 void stop();
38 38
39 void deliverObservationsForTesting();
40
39 DECLARE_VIRTUAL_TRACE(); 41 DECLARE_VIRTUAL_TRACE();
40 42
41 private: 43 private:
42 class ElementVisibilityCallback; 44 class ElementVisibilityCallback;
43 45
44 void onVisibilityChanged( 46 void onVisibilityChanged(
45 const HeapVector<Member<IntersectionObserverEntry>>&); 47 const HeapVector<Member<IntersectionObserverEntry>>&);
46 48
47 Member<Element> m_element; 49 Member<Element> m_element;
48 Member<IntersectionObserver> m_intersectionObserver; 50 Member<IntersectionObserver> m_intersectionObserver;
49 std::unique_ptr<VisibilityCallback> m_callback; 51 std::unique_ptr<VisibilityCallback> m_callback;
50 }; 52 };
51 53
52 } // namespace blink 54 } // namespace blink
53 55
54 #endif // ElementVisibilityObserver_h 56 #endif // ElementVisibilityObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698