Chromium Code Reviews| 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 f2a4129d0bd3ac00f9d88dfd600842707126f8d1..5df39d42dac2dabeaca1536fa2d53ec20affadf2 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" |
| @@ -52,6 +53,7 @@ |
| namespace blink { |
| class AXObjectCache; |
| +class CancellableTaskFactory; |
| class ComputedStyle; |
| class DocumentLifecycle; |
| class Cursor; |
| @@ -82,6 +84,7 @@ class CORE_EXPORT FrameView final : public Widget, public ScrollableArea { |
| friend class DisplayItemListPaintTestForSlimmingPaintV2; |
| friend class Internals; |
| friend class LayoutPart; // for invalidateTreeIfNeeded |
| + friend class FrameThrottlingTest; |
| public: |
| static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*); |
| @@ -225,16 +228,18 @@ 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); |
| // Computes only the style and layout lifecycle stages. |
| // After calling this method, all frames will be in a lifecycle state >= LayoutClean. |
| - void updateLifecycleToLayoutClean(); |
| + void updateLifecycleToLayoutClean(DocumentLifecycle::ThrottlingMode = DocumentLifecycle::ThrottlingMode::Disallow); |
| bool invalidateViewportConstrainedObjects(); |
| @@ -556,6 +561,14 @@ 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; |
|
ojan
2015/10/13 23:31:29
These names are confusing. They're both basically
Sami
2015/10/14 16:52:11
Agreed, I like those better. Changed and reworded
|
| + |
| protected: |
| // Scroll the content via the compositor. |
| bool scrollContentsFastPath(const IntSize& scrollDelta); |
| @@ -610,7 +623,7 @@ private: |
| AllPhases, |
| }; |
| - void updateLifecyclePhasesInternal(LifeCycleUpdateOption, const LayoutRect& interestRect = LayoutRect::infiniteRect()); |
| + void updateLifecyclePhasesInternal(LifeCycleUpdateOption, DocumentLifecycle::ThrottlingMode, const LayoutRect& interestRect = LayoutRect::infiniteRect()); |
| void invalidateTreeIfNeededRecursive(); |
| void scrollContentsIfNeededRecursive(); |
| void updateStyleAndLayoutIfNeededRecursive(); |
| @@ -716,6 +729,11 @@ private: |
| void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&); |
| void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&); |
| + void setLifecycleThrottlingModeForSubtree(DocumentLifecycle::ThrottlingMode); |
| + void updateViewportIntersectionsForSubtree(); |
| + void updateViewportIntersectionIfNeeded(); |
| + void notifyIntersectionObservers(); |
| + |
| LayoutSize m_size; |
| typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; |
| @@ -750,6 +768,7 @@ private: |
| unsigned m_nestedLayoutCount; |
| Timer<FrameView> m_postLayoutTasksTimer; |
| Timer<FrameView> m_updateWidgetsTimer; |
| + OwnPtr<CancellableTaskFactory> m_intersectionObserverNotificationFactory; |
| bool m_firstLayout; |
| bool m_isTransparent; |
| @@ -797,6 +816,7 @@ private: |
| float m_topControlsViewportAdjustment; |
| bool m_needsUpdateWidgetPositions; |
| + bool m_needsUpdateViewportIntersection; |
| #if ENABLE(ASSERT) |
| // Verified when finalizing. |
| @@ -832,6 +852,21 @@ 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_viewportIntersection; |
| + bool m_viewportIntersectionValid; |
| + |
| + enum class ViewportVisibility { Hidden, Visible }; |
| + enum class SecurityOriginStatus { IsSameOrigin, IsCrossOrigin }; |
| + |
| + // 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; |
| + SecurityOriginStatus m_securityOriginStatusForThrottling; |
| }; |
| inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) |