Chromium Code Reviews| 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 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 Loading... | |
| 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(); | |
|
szager1
2016/10/25 22:39:35
Can we avoid this by adding calls to runPendingTas
Sami
2016/10/26 17:59:35
Unfortunately FrameThrottlingTest::ThrottleSubtree
| |
| 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 |
| OLD | NEW |