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

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

Issue 1246173002: Throttle rendering pipeline for invisible iframes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments. 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
« no previous file with comments | « no previous file | Source/core/frame/FrameView.cpp » ('j') | Source/core/frame/FrameView.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.h
diff --git a/Source/core/frame/FrameView.h b/Source/core/frame/FrameView.h
index a1b2b4383ff62b44434aa193bdc964110947d04a..4c3b3b6f528a3d5137f015067e65cdb715357837 100644
--- a/Source/core/frame/FrameView.h
+++ b/Source/core/frame/FrameView.h
@@ -226,11 +226,14 @@ public:
Color documentBackgroundColor() const;
// Run all needed lifecycle stages. After calling this method, all frames will be in the lifecycle state PaintInvalidationClean.
- void updateAllLifecyclePhases();
+ // If lifecycle throttling is allowed, some frames may skip the lifecycle update (e.g., based on visibility) and will not end
+ // up being PaintInvalidationClean.
+ enum class LifecycleThrottlingMode { Disallow, Allow };
+ void updateAllLifecyclePhases(LifecycleThrottlingMode = LifecycleThrottlingMode::Disallow);
// 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(LifecycleThrottlingMode = LifecycleThrottlingMode::Disallow);
bool invalidateViewportConstrainedObjects();
@@ -559,6 +562,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;
+
+ // Updates the throttling status of all frames in the hierarchy and
+ // schedules new animations or lifecycle updates as necessary. Must be
+ // called after the layer update phase of the current BeginMainFrame.
+ void updateThrottling();
+
protected:
// Scroll the content via the compositor.
bool scrollContentsFastPath(const IntSize& scrollDelta);
@@ -612,7 +628,7 @@ private:
OnlyUpToCompositingCleanPlusScrolling,
};
- void updateLifecyclePhasesInternal(LifeCycleUpdateOption);
+ void updateLifecyclePhasesInternal(LifeCycleUpdateOption, LifecycleThrottlingMode);
void invalidateTreeIfNeededRecursive();
void scrollContentsIfNeededRecursive();
void updateStyleAndLayoutIfNeededRecursive();
@@ -717,6 +733,10 @@ private:
void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&);
void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&);
+ void computeViewportVisibility();
+ void setLifecycleThrottlingModeRecursive(LifecycleThrottlingMode);
+ void updateThrottlingRecursive(bool hasCrossedSecurityOrigin);
+
LayoutSize m_size;
typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet;
@@ -839,6 +859,21 @@ private:
// TODO(bokan): crbug.com/484188. We should specialize FrameView for the
// main frame.
OwnPtrWillBeMember<ScrollableArea> m_viewportScrollableArea;
+
+ LifecycleThrottlingMode m_lifecycleThrottlingMode;
+ // 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, Unknown };
+ ViewportVisibility m_viewportVisibility;
+
+ // 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_viewportVisibilityForThrottling;
+ bool m_isCrossOriginForThrottling;
};
inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
« no previous file with comments | « no previous file | Source/core/frame/FrameView.cpp » ('j') | Source/core/frame/FrameView.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698