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: Turns out we need the check after all 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 HTMLFrameOwnerElement; 68 class HTMLFrameOwnerElement;
68 class JSONArray; 69 class JSONArray;
69 class JSONObject; 70 class JSONObject;
70 class LayoutItem; 71 class LayoutItem;
71 class LayoutViewItem; 72 class LayoutViewItem;
72 class LayoutPart; 73 class LayoutPart;
73 class LocalFrame; 74 class LocalFrame;
74 class KURL; 75 class KURL;
75 class Node; 76 class Node;
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 670
670 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); } 671 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); }
671 672
672 // Returns true if this frame should not render or schedule visual updates. 673 // Returns true if this frame should not render or schedule visual updates.
673 bool shouldThrottleRendering() const; 674 bool shouldThrottleRendering() const;
674 675
675 // Returns true if this frame could potentially skip rendering and avoid 676 // Returns true if this frame could potentially skip rendering and avoid
676 // scheduling visual updates. 677 // scheduling visual updates.
677 bool canThrottleRendering() const; 678 bool canThrottleRendering() const;
678 bool isHiddenForThrottling() const { return m_hiddenForThrottling; } 679 bool isHiddenForThrottling() const { return m_hiddenForThrottling; }
680 void setupRenderThrottling();
679 681
680 // For testing, run pending intersection observer notifications for this 682 // For testing, run pending intersection observer notifications for this
681 // frame. 683 // frame.
682 void notifyRenderThrottlingObserversForTesting(); 684 void updateRenderThrottlingStatusForTesting();
683 685
684 // Paint properties for SPv2 Only. 686 // Paint properties for SPv2 Only.
685 void setPreTranslation( 687 void setPreTranslation(
686 PassRefPtr<TransformPaintPropertyNode> preTranslation) { 688 PassRefPtr<TransformPaintPropertyNode> preTranslation) {
687 m_preTranslation = preTranslation; 689 m_preTranslation = preTranslation;
688 } 690 }
689 TransformPaintPropertyNode* preTranslation() const { 691 TransformPaintPropertyNode* preTranslation() const {
690 return m_preTranslation.get(); 692 return m_preTranslation.get();
691 } 693 }
692 694
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 911
910 void collectAnnotatedRegions(LayoutObject&, 912 void collectAnnotatedRegions(LayoutObject&,
911 Vector<AnnotatedRegionValue>&) const; 913 Vector<AnnotatedRegionValue>&) const;
912 914
913 template <typename Function> 915 template <typename Function>
914 void forAllNonThrottledFrameViews(const Function&); 916 void forAllNonThrottledFrameViews(const Function&);
915 917
916 void setNeedsUpdateViewportIntersection(); 918 void setNeedsUpdateViewportIntersection();
917 void updateViewportIntersectionsForSubtree( 919 void updateViewportIntersectionsForSubtree(
918 DocumentLifecycle::LifecycleState targetState); 920 DocumentLifecycle::LifecycleState targetState);
919 void updateViewportIntersectionIfNeeded(); 921 void updateRenderThrottlingStatus(bool hidden, bool subtreeThrottled);
920 void notifyRenderThrottlingObservers();
921 void updateThrottlingStatus();
922 void notifyResizeObservers(); 922 void notifyResizeObservers();
923 923
924 // PaintInvalidationCapableScrollableArea 924 // PaintInvalidationCapableScrollableArea
925 LayoutScrollbarPart* resizer() const override { return nullptr; } 925 LayoutScrollbarPart* resizer() const override { return nullptr; }
926 926
927 bool checkLayoutInvalidationIsAllowed() const; 927 bool checkLayoutInvalidationIsAllowed() const;
928 928
929 PaintController* paintController() { return m_paintController.get(); } 929 PaintController* paintController() { return m_paintController.get(); }
930 930
931 LayoutSize m_size; 931 LayoutSize m_size;
(...skipping 21 matching lines...) Expand all
953 bool m_hasPendingLayout; 953 bool m_hasPendingLayout;
954 LayoutSubtreeRootList m_layoutSubtreeRootList; 954 LayoutSubtreeRootList m_layoutSubtreeRootList;
955 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList; 955 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList;
956 956
957 bool m_layoutSchedulingEnabled; 957 bool m_layoutSchedulingEnabled;
958 bool m_inSynchronousPostLayout; 958 bool m_inSynchronousPostLayout;
959 int m_layoutCount; 959 int m_layoutCount;
960 unsigned m_nestedLayoutCount; 960 unsigned m_nestedLayoutCount;
961 Timer<FrameView> m_postLayoutTasksTimer; 961 Timer<FrameView> m_postLayoutTasksTimer;
962 Timer<FrameView> m_updateWidgetsTimer; 962 Timer<FrameView> m_updateWidgetsTimer;
963 std::unique_ptr<CancellableTaskFactory>
964 m_renderThrottlingObserverNotificationFactory;
965 963
966 bool m_firstLayout; 964 bool m_firstLayout;
967 bool m_isTransparent; 965 bool m_isTransparent;
968 Color m_baseBackgroundColor; 966 Color m_baseBackgroundColor;
969 IntSize m_lastViewportSize; 967 IntSize m_lastViewportSize;
970 float m_lastZoomFactor; 968 float m_lastZoomFactor;
971 969
972 AtomicString m_mediaType; 970 AtomicString m_mediaType;
973 AtomicString m_mediaTypeWhenNotPrinting; 971 AtomicString m_mediaTypeWhenNotPrinting;
974 972
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1032
1035 // Mark if something has changed in the mapping from Frame to GraphicsLayer 1033 // Mark if something has changed in the mapping from Frame to GraphicsLayer
1036 // and the Frame Timing regions should be recalculated. 1034 // and the Frame Timing regions should be recalculated.
1037 bool m_frameTimingRequestsDirty; 1035 bool m_frameTimingRequestsDirty;
1038 1036
1039 // Exists only on root frame. 1037 // Exists only on root frame.
1040 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the 1038 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the
1041 // main frame. 1039 // main frame.
1042 Member<RootFrameViewport> m_viewportScrollableArea; 1040 Member<RootFrameViewport> m_viewportScrollableArea;
1043 1041
1044 // This frame's bounds in the root frame's content coordinates, clipped
1045 // recursively through every ancestor view.
1046 IntRect m_viewportIntersection;
1047 bool m_viewportIntersectionValid;
1048
1049 // The following members control rendering pipeline throttling for this 1042 // The following members control rendering pipeline throttling for this
1050 // frame. They are only updated in response to intersection observer 1043 // frame. They are only updated in response to intersection observer
1051 // notifications, i.e., not in the middle of the lifecycle. 1044 // notifications, i.e., not in the middle of the lifecycle.
1052 bool m_hiddenForThrottling; 1045 bool m_hiddenForThrottling;
1053 bool m_crossOriginForThrottling;
1054 bool m_subtreeThrottled; 1046 bool m_subtreeThrottled;
1055 1047
1056 // Paint properties for SPv2 Only. 1048 // Paint properties for SPv2 Only.
1057 // The hierarchy of transform subtree created by a FrameView. 1049 // The hierarchy of transform subtree created by a FrameView.
1058 // [ preTranslation ] The offset from Widget::frameRect. 1050 // [ preTranslation ] The offset from Widget::frameRect.
1059 // | Establishes viewport. 1051 // | Establishes viewport.
1060 // +---[ scrollTranslation ] Frame scrolling. 1052 // +---[ scrollTranslation ] Frame scrolling.
1061 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is 1053 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is
1062 // enabled. 1054 // enabled.
1063 RefPtr<TransformPaintPropertyNode> m_preTranslation; 1055 RefPtr<TransformPaintPropertyNode> m_preTranslation;
(...skipping 13 matching lines...) Expand all
1077 1069
1078 ScrollAnchor m_scrollAnchor; 1070 ScrollAnchor m_scrollAnchor;
1079 1071
1080 // ScrollbarManager holds the Scrollbar instances. 1072 // ScrollbarManager holds the Scrollbar instances.
1081 ScrollbarManager m_scrollbarManager; 1073 ScrollbarManager m_scrollbarManager;
1082 1074
1083 bool m_needsScrollbarsUpdate; 1075 bool m_needsScrollbarsUpdate;
1084 bool m_suppressAdjustViewSize; 1076 bool m_suppressAdjustViewSize;
1085 bool m_allowsLayoutInvalidationAfterLayoutClean; 1077 bool m_allowsLayoutInvalidationAfterLayoutClean;
1086 1078
1079 Member<ElementVisibilityObserver> m_visibilityObserver;
1080
1087 // For testing. 1081 // For testing.
1088 struct ObjectPaintInvalidation { 1082 struct ObjectPaintInvalidation {
1089 String name; 1083 String name;
1090 PaintInvalidationReason reason; 1084 PaintInvalidationReason reason;
1091 }; 1085 };
1092 std::unique_ptr<Vector<ObjectPaintInvalidation>> 1086 std::unique_ptr<Vector<ObjectPaintInvalidation>>
1093 m_trackedObjectPaintInvalidations; 1087 m_trackedObjectPaintInvalidations;
1094 1088
1095 // For Slimming Paint v2 only. 1089 // For Slimming Paint v2 only.
1096 std::unique_ptr<PaintController> m_paintController; 1090 std::unique_ptr<PaintController> m_paintController;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 widget.isFrameView()); 1122 widget.isFrameView());
1129 DEFINE_TYPE_CASTS(FrameView, 1123 DEFINE_TYPE_CASTS(FrameView,
1130 ScrollableArea, 1124 ScrollableArea,
1131 scrollableArea, 1125 scrollableArea,
1132 scrollableArea->isFrameView(), 1126 scrollableArea->isFrameView(),
1133 scrollableArea.isFrameView()); 1127 scrollableArea.isFrameView());
1134 1128
1135 } // namespace blink 1129 } // namespace blink
1136 1130
1137 #endif // FrameView_h 1131 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698