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

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

Issue 1246173002: Throttle rendering pipeline for invisible iframes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased to post merge awesomeness. 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 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 f9a26739b6a91a856fb17904cc6517a1d0a346c9..db7a683c54e8935afe22e2bfb87c58c71dbc7815 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.h
+++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -26,6 +26,7 @@
#define FrameView_h
#include "core/CoreExport.h"
+#include "core/dom/DocumentLifecycle.h"
#include "core/frame/FrameViewAutoSizeInfo.h"
#include "core/frame/LayoutSubtreeRootList.h"
#include "core/frame/RootFrameViewport.h"
@@ -82,6 +83,7 @@ class CORE_EXPORT FrameView final : public Widget, public ScrollableArea {
friend class Internals;
friend class LayoutPart; // for invalidateTreeIfNeeded
friend class LayoutView; // for contentRectangleForPaintInvalidation
+ friend class FrameThrottlingTest;
public:
static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*);
@@ -226,12 +228,14 @@ public:
Color documentBackgroundColor() const;
// Run all needed lifecycle stages. After calling this method, all frames will be in the lifecycle state PaintInvalidationClean.
+ // If lifecycle throttling is allowed, some frames may skip the lifecycle update (e.g., based on visibility) and will not end
+ // up being PaintInvalidationClean.
// TODO(pdr): Update callers to pass in the interest rect.
- void updateAllLifecyclePhases(const LayoutRect& interestRect = LayoutRect::infiniteRect());
+ void updateAllLifecyclePhases(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::Disallow, const LayoutRect& interestRect = LayoutRect::infiniteRect());
// Computes the style, layout and compositing lifecycle stages if needed. After calling this method, all frames wil lbe in a lifecycle
// state >= CompositingClean, and scrolling has been updated.
- void updateLifecycleToCompositingCleanPlusScrolling();
+ void updateLifecycleToCompositingCleanPlusScrolling(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::Disallow);
bool invalidateViewportConstrainedObjects();
@@ -557,6 +561,19 @@ public:
void setFrameTimingRequestsDirty(bool isDirty) { m_frameTimingRequestsDirty = isDirty; }
bool frameTimingRequestsDirty() { return m_frameTimingRequestsDirty; }
+ // Returns true if this frame should skip rendering pipeline processing during the
+ // current BeginMainFrame.
+ bool shouldThrottleRenderingPipeline() const;
+
+ // Returns true if this frame should skip style computation, layout and
+ // compositing updates for the current BeginMainFrame.
+ bool shouldThrottleStyleLayoutAndCompositingUpdates() const;
+
+ // Called to signal the end of a lifecycle update. Updates the throttling
+ // status of all frames in the hierarchy and schedules new animations or
+ // lifecycle updates as necessary.
+ void finalizeLifecycleUpdate();
+
protected:
// Scroll the content via the compositor.
bool scrollContentsFastPath(const IntSize& scrollDelta);
@@ -610,7 +627,7 @@ private:
OnlyUpToCompositingCleanPlusScrolling,
};
- void updateLifecyclePhasesInternal(LifeCycleUpdateOption, const LayoutRect& interestRect = LayoutRect::infiniteRect());
+ void updateLifecyclePhasesInternal(LifeCycleUpdateOption, DocumentLifecycle::ThrottlingMode, const LayoutRect& interestRect = LayoutRect::infiniteRect());
void invalidateTreeIfNeededRecursive();
void scrollContentsIfNeededRecursive();
void updateStyleAndLayoutIfNeededRecursive();
@@ -715,6 +732,12 @@ private:
void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&);
void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&);
+ void updateViewportVisibilityIfNeeded();
+ void setLifecycleThrottlingModeForSubtree(DocumentLifecycle::ThrottlingMode);
+
+ enum class SecurityOriginStatus { IsSameOrigin, IsCrossOrigin };
+ void updateThrottlingRecursive(SecurityOriginStatus);
+
LayoutSize m_size;
typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet;
@@ -796,6 +819,7 @@ private:
float m_topControlsViewportAdjustment;
bool m_needsUpdateWidgetPositions;
+ bool m_needsUpdateViewportVisibility;
#if ENABLE(ASSERT)
// Verified when finalizing.
@@ -833,6 +857,19 @@ private:
// TODO(bokan): crbug.com/484188. We should specialize FrameView for the
// main frame.
OwnPtrWillBeMember<ScrollableArea> m_viewportScrollableArea;
+
+ // This frame's bounds in the root frame's content coordinates, clipped
+ // recursively through every ancestor view.
+ IntRect m_clippedBounds;
+
+ enum class ViewportVisibility { Hidden, Visible };
+
+ // The following members control rendering pipeline throttling for this
+ // frame. They are only updated at the end of the pipeline (after painting)
+ // to avoid running further pipeline stages for a frame without having gone
+ // through the previous ones.
+ ViewportVisibility m_viewportVisibility;
+ SecurityOriginStatus m_securityOriginStatusForThrottling;
};
inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
« no previous file with comments | « third_party/WebKit/Source/core/dom/DocumentLifecycle.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698