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

Side by Side 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: Update LeakExpectations Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 (C) 1998 Waldo Bastian (bastian@kde.org) 3 (C) 1998 Waldo Bastian (bastian@kde.org)
4 (C) 1998, 1999 Torben Weis (weis@kde.org) 4 (C) 1998, 1999 Torben Weis (weis@kde.org)
5 (C) 1999 Lars Knoll (knoll@kde.org) 5 (C) 1999 Lars Knoll (knoll@kde.org)
6 (C) 1999 Antti Koivisto (koivisto@kde.org) 6 (C) 1999 Antti Koivisto (koivisto@kde.org)
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
8 reserved. 8 reserved.
9 9
10 This library is free software; you can redistribute it and/or 10 This library is free software; you can redistribute it and/or
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include <memory> 56 #include <memory>
57 57
58 namespace blink { 58 namespace blink {
59 59
60 class AXObjectCache; 60 class AXObjectCache;
61 class CancellableTaskFactory; 61 class CancellableTaskFactory;
62 class ComputedStyle; 62 class ComputedStyle;
63 class DocumentLifecycle; 63 class DocumentLifecycle;
64 class Cursor; 64 class Cursor;
65 class Element; 65 class Element;
66 class ElementVisibilityObserver;
66 class FloatSize; 67 class FloatSize;
67 class JSONArray; 68 class JSONArray;
68 class JSONObject; 69 class JSONObject;
69 class LayoutItem; 70 class LayoutItem;
70 class LayoutViewItem; 71 class LayoutViewItem;
71 class LayoutPart; 72 class LayoutPart;
72 class LocalFrame; 73 class LocalFrame;
73 class KURL; 74 class KURL;
74 class Node; 75 class Node;
75 class LayoutAnalyzer; 76 class LayoutAnalyzer;
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 669
669 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); } 670 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); }
670 671
671 // Returns true if this frame should not render or schedule visual updates. 672 // Returns true if this frame should not render or schedule visual updates.
672 bool shouldThrottleRendering() const; 673 bool shouldThrottleRendering() const;
673 674
674 // Returns true if this frame could potentially skip rendering and avoid 675 // Returns true if this frame could potentially skip rendering and avoid
675 // scheduling visual updates. 676 // scheduling visual updates.
676 bool canThrottleRendering() const; 677 bool canThrottleRendering() const;
677 bool isHiddenForThrottling() const { return m_hiddenForThrottling; } 678 bool isHiddenForThrottling() const { return m_hiddenForThrottling; }
679 void setupRenderThrottling();
678 680
679 // For testing, run pending intersection observer notifications for this 681 // For testing, run pending intersection observer notifications for this
680 // frame. 682 // frame.
681 void notifyRenderThrottlingObserversForTesting(); 683 void updateRenderThrottlingStatusForTesting();
682 684
683 // Paint properties for SPv2 Only. 685 // Paint properties for SPv2 Only.
684 void setPreTranslation( 686 void setPreTranslation(
685 PassRefPtr<TransformPaintPropertyNode> preTranslation) { 687 PassRefPtr<TransformPaintPropertyNode> preTranslation) {
686 m_preTranslation = preTranslation; 688 m_preTranslation = preTranslation;
687 } 689 }
688 TransformPaintPropertyNode* preTranslation() const { 690 TransformPaintPropertyNode* preTranslation() const {
689 return m_preTranslation.get(); 691 return m_preTranslation.get();
690 } 692 }
691 693
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 914
913 void collectAnnotatedRegions(LayoutObject&, 915 void collectAnnotatedRegions(LayoutObject&,
914 Vector<AnnotatedRegionValue>&) const; 916 Vector<AnnotatedRegionValue>&) const;
915 917
916 template <typename Function> 918 template <typename Function>
917 void forAllNonThrottledFrameViews(const Function&); 919 void forAllNonThrottledFrameViews(const Function&);
918 920
919 void setNeedsUpdateViewportIntersection(); 921 void setNeedsUpdateViewportIntersection();
920 void updateViewportIntersectionsForSubtree( 922 void updateViewportIntersectionsForSubtree(
921 DocumentLifecycle::LifecycleState targetState); 923 DocumentLifecycle::LifecycleState targetState);
922 void updateViewportIntersectionIfNeeded(); 924 void updateRenderThrottlingStatus(bool hidden, bool subtreeThrottled);
923 void notifyRenderThrottlingObservers();
924 void updateThrottlingStatus();
925 void notifyResizeObservers(); 925 void notifyResizeObservers();
926 926
927 // PaintInvalidationCapableScrollableArea 927 // PaintInvalidationCapableScrollableArea
928 LayoutScrollbarPart* resizer() const override { return nullptr; } 928 LayoutScrollbarPart* resizer() const override { return nullptr; }
929 929
930 bool checkLayoutInvalidationIsAllowed() const; 930 bool checkLayoutInvalidationIsAllowed() const;
931 931
932 PaintController* paintController() { return m_paintController.get(); } 932 PaintController* paintController() { return m_paintController.get(); }
933 933
934 LayoutSize m_size; 934 LayoutSize m_size;
(...skipping 21 matching lines...) Expand all
956 bool m_hasPendingLayout; 956 bool m_hasPendingLayout;
957 LayoutSubtreeRootList m_layoutSubtreeRootList; 957 LayoutSubtreeRootList m_layoutSubtreeRootList;
958 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList; 958 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList;
959 959
960 bool m_layoutSchedulingEnabled; 960 bool m_layoutSchedulingEnabled;
961 bool m_inSynchronousPostLayout; 961 bool m_inSynchronousPostLayout;
962 int m_layoutCount; 962 int m_layoutCount;
963 unsigned m_nestedLayoutCount; 963 unsigned m_nestedLayoutCount;
964 Timer<FrameView> m_postLayoutTasksTimer; 964 Timer<FrameView> m_postLayoutTasksTimer;
965 Timer<FrameView> m_updateWidgetsTimer; 965 Timer<FrameView> m_updateWidgetsTimer;
966 std::unique_ptr<CancellableTaskFactory>
967 m_renderThrottlingObserverNotificationFactory;
968 966
969 bool m_firstLayout; 967 bool m_firstLayout;
970 bool m_isTransparent; 968 bool m_isTransparent;
971 Color m_baseBackgroundColor; 969 Color m_baseBackgroundColor;
972 IntSize m_lastViewportSize; 970 IntSize m_lastViewportSize;
973 float m_lastZoomFactor; 971 float m_lastZoomFactor;
974 972
975 AtomicString m_mediaType; 973 AtomicString m_mediaType;
976 AtomicString m_mediaTypeWhenNotPrinting; 974 AtomicString m_mediaTypeWhenNotPrinting;
977 975
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1035
1038 // Mark if something has changed in the mapping from Frame to GraphicsLayer 1036 // Mark if something has changed in the mapping from Frame to GraphicsLayer
1039 // and the Frame Timing regions should be recalculated. 1037 // and the Frame Timing regions should be recalculated.
1040 bool m_frameTimingRequestsDirty; 1038 bool m_frameTimingRequestsDirty;
1041 1039
1042 // Exists only on root frame. 1040 // Exists only on root frame.
1043 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the 1041 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the
1044 // main frame. 1042 // main frame.
1045 Member<RootFrameViewport> m_viewportScrollableArea; 1043 Member<RootFrameViewport> m_viewportScrollableArea;
1046 1044
1047 // This frame's bounds in the root frame's content coordinates, clipped
1048 // recursively through every ancestor view.
1049 IntRect m_viewportIntersection;
1050 bool m_viewportIntersectionValid;
1051
1052 // The following members control rendering pipeline throttling for this 1045 // The following members control rendering pipeline throttling for this
1053 // frame. They are only updated in response to intersection observer 1046 // frame. They are only updated in response to intersection observer
1054 // notifications, i.e., not in the middle of the lifecycle. 1047 // notifications, i.e., not in the middle of the lifecycle.
1055 bool m_hiddenForThrottling; 1048 bool m_hiddenForThrottling;
1056 bool m_crossOriginForThrottling;
1057 bool m_subtreeThrottled; 1049 bool m_subtreeThrottled;
1058 1050
1059 // Paint properties for SPv2 Only. 1051 // Paint properties for SPv2 Only.
1060 // The hierarchy of transform subtree created by a FrameView. 1052 // The hierarchy of transform subtree created by a FrameView.
1061 // [ preTranslation ] The offset from Widget::frameRect. 1053 // [ preTranslation ] The offset from Widget::frameRect.
1062 // | Establishes viewport. 1054 // | Establishes viewport.
1063 // +---[ scrollTranslation ] Frame scrolling. 1055 // +---[ scrollTranslation ] Frame scrolling.
1064 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is 1056 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is
1065 // enabled. 1057 // enabled.
1066 RefPtr<TransformPaintPropertyNode> m_preTranslation; 1058 RefPtr<TransformPaintPropertyNode> m_preTranslation;
(...skipping 16 matching lines...) Expand all
1083 HeapLinkedHashSet<WeakMember<ScrollableArea>>; 1075 HeapLinkedHashSet<WeakMember<ScrollableArea>>;
1084 AnchoringAdjustmentQueue m_anchoringAdjustmentQueue; 1076 AnchoringAdjustmentQueue m_anchoringAdjustmentQueue;
1085 1077
1086 // ScrollbarManager holds the Scrollbar instances. 1078 // ScrollbarManager holds the Scrollbar instances.
1087 ScrollbarManager m_scrollbarManager; 1079 ScrollbarManager m_scrollbarManager;
1088 1080
1089 bool m_needsScrollbarsUpdate; 1081 bool m_needsScrollbarsUpdate;
1090 bool m_suppressAdjustViewSize; 1082 bool m_suppressAdjustViewSize;
1091 bool m_allowsLayoutInvalidationAfterLayoutClean; 1083 bool m_allowsLayoutInvalidationAfterLayoutClean;
1092 1084
1085 Member<ElementVisibilityObserver> m_visibilityObserver;
1086
1093 // For testing. 1087 // For testing.
1094 struct ObjectPaintInvalidation { 1088 struct ObjectPaintInvalidation {
1095 String name; 1089 String name;
1096 PaintInvalidationReason reason; 1090 PaintInvalidationReason reason;
1097 }; 1091 };
1098 std::unique_ptr<Vector<ObjectPaintInvalidation>> 1092 std::unique_ptr<Vector<ObjectPaintInvalidation>>
1099 m_trackedObjectPaintInvalidations; 1093 m_trackedObjectPaintInvalidations;
1100 1094
1101 // For Slimming Paint v2 only. 1095 // For Slimming Paint v2 only.
1102 std::unique_ptr<PaintController> m_paintController; 1096 std::unique_ptr<PaintController> m_paintController;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 widget.isFrameView()); 1128 widget.isFrameView());
1135 DEFINE_TYPE_CASTS(FrameView, 1129 DEFINE_TYPE_CASTS(FrameView,
1136 ScrollableArea, 1130 ScrollableArea,
1137 scrollableArea, 1131 scrollableArea,
1138 scrollableArea->isFrameView(), 1132 scrollableArea->isFrameView(),
1139 scrollableArea.isFrameView()); 1133 scrollableArea.isFrameView());
1140 1134
1141 } // namespace blink 1135 } // namespace blink
1142 1136
1143 #endif // FrameView_h 1137 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698