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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.h

Issue 2272773002: Use intersection observer to control frame throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust OOPIF expectations Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.h
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h
index 55f071cafc334489d06d45c50113a5303dd18096..570c3caa3603b464aa6f563de83d28a6b5de65da 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.h
+++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -27,6 +27,7 @@
#include "core/CoreExport.h"
#include "core/dom/DocumentLifecycle.h"
+#include "core/dom/IntersectionObserverCallback.h"
#include "core/frame/FrameViewAutoSizeInfo.h"
#include "core/frame/LayoutSubtreeRootList.h"
#include "core/frame/RootFrameViewport.h"
@@ -591,9 +592,10 @@ public:
// scheduling visual updates.
bool canThrottleRendering() const;
bool isHiddenForThrottling() const { return m_hiddenForThrottling; }
+ void setupRenderThrottling();
// For testing, run pending intersection observer notifications for this frame.
- void notifyRenderThrottlingObserversForTesting();
+ void updateRenderThrottlingStatusForTesting();
// Paint properties for SPv2 Only.
void setPreTranslation(PassRefPtr<TransformPaintPropertyNode> preTranslation) { m_preTranslation = preTranslation; }
@@ -668,6 +670,20 @@ protected:
void invalidateTreeIfNeeded(const PaintInvalidationState&);
private:
+ class IntersectionObserverCallback : public blink::IntersectionObserverCallback {
+ public:
+ IntersectionObserverCallback(FrameView*);
+
+ // IntersectionObserverCallback implementation:
+ void handleEvent(const HeapVector<Member<IntersectionObserverEntry>>&, IntersectionObserver&) override;
+ ExecutionContext* getExecutionContext() const override;
+
+ DECLARE_TRACE();
+
+ private:
+ Member<FrameView> m_frameView;
szager1 2016/08/30 23:57:12 I think this should be WeakMember, to avoid a refe
Sami 2016/08/31 11:08:56 I guess I was thinking that with Oilpan in-heap re
+ };
+
explicit FrameView(LocalFrame*);
void setScrollOffset(const DoublePoint&, ScrollType) override;
@@ -778,9 +794,7 @@ private:
void setNeedsUpdateViewportIntersection();
void updateViewportIntersectionsForSubtree(DocumentLifecycle::LifecycleState targetState);
- void updateViewportIntersectionIfNeeded();
- void notifyRenderThrottlingObservers();
- void updateThrottlingStatus();
+ void updateRenderThrottlingStatus(bool hidden, bool subtreeThrottled);
void notifyResizeObservers();
// PaintInvalidationCapableScrollableArea
@@ -819,7 +833,6 @@ private:
unsigned m_nestedLayoutCount;
Timer<FrameView> m_postLayoutTasksTimer;
Timer<FrameView> m_updateWidgetsTimer;
- std::unique_ptr<CancellableTaskFactory> m_renderThrottlingObserverNotificationFactory;
bool m_firstLayout;
bool m_isTransparent;
@@ -901,16 +914,10 @@ private:
// main frame.
Member<RootFrameViewport> m_viewportScrollableArea;
- // This frame's bounds in the root frame's content coordinates, clipped
- // recursively through every ancestor view.
- IntRect m_viewportIntersection;
- bool m_viewportIntersectionValid;
-
// The following members control rendering pipeline throttling for this
// frame. They are only updated in response to intersection observer
// notifications, i.e., not in the middle of the lifecycle.
bool m_hiddenForThrottling;
- bool m_crossOriginForThrottling;
bool m_subtreeThrottled;
// Paint properties for SPv2 Only.
@@ -939,6 +946,8 @@ private:
bool m_suppressAdjustViewSize;
bool m_allowsLayoutInvalidationAfterLayoutClean;
+ Member<IntersectionObserver> m_intersectionObserver;
+
// For testing.
struct ObjectPaintInvalidation {
String name;

Powered by Google App Engine
This is Rietveld 408576698