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

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: Ojan's 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
Index: Source/core/frame/FrameView.h
diff --git a/Source/core/frame/FrameView.h b/Source/core/frame/FrameView.h
index a1b2b4383ff62b44434aa193bdc964110947d04a..26e6db7ceaf6fd9e774f1ce5af9b792989e5f149 100644
--- a/Source/core/frame/FrameView.h
+++ b/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"
@@ -52,7 +53,6 @@
namespace blink {
class AXObjectCache;
-class DocumentLifecycle;
class Cursor;
class Element;
class FloatSize;
@@ -226,11 +226,13 @@ 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.
+ void updateAllLifecyclePhases(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::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(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::Disallow);
bool invalidateViewportConstrainedObjects();
@@ -559,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;
+
+ // 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 +627,7 @@ private:
OnlyUpToCompositingCleanPlusScrolling,
};
- void updateLifecyclePhasesInternal(LifeCycleUpdateOption);
+ void updateLifecyclePhasesInternal(LifeCycleUpdateOption, DocumentLifecycle::ThrottlingMode);
void invalidateTreeIfNeededRecursive();
void scrollContentsIfNeededRecursive();
void updateStyleAndLayoutIfNeededRecursive();
@@ -717,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;
@@ -801,6 +822,7 @@ private:
float m_topControlsViewportAdjustment;
bool m_needsUpdateWidgetPositions;
+ bool m_needsUpdateViewportVisibility;
#if ENABLE(ASSERT)
// Verified when finalizing.
@@ -839,6 +861,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)

Powered by Google App Engine
This is Rietveld 408576698