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

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: Add support for setting initial observer state 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include <memory> 55 #include <memory>
56 56
57 namespace blink { 57 namespace blink {
58 58
59 class AXObjectCache; 59 class AXObjectCache;
60 class CancellableTaskFactory; 60 class CancellableTaskFactory;
61 class ComputedStyle; 61 class ComputedStyle;
62 class DocumentLifecycle; 62 class DocumentLifecycle;
63 class Cursor; 63 class Cursor;
64 class Element; 64 class Element;
65 class ElementVisibilityObserver;
65 class FloatSize; 66 class FloatSize;
66 class HTMLFrameOwnerElement; 67 class HTMLFrameOwnerElement;
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;
(...skipping 593 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 897
896 void collectAnnotatedRegions(LayoutObject&, 898 void collectAnnotatedRegions(LayoutObject&,
897 Vector<AnnotatedRegionValue>&) const; 899 Vector<AnnotatedRegionValue>&) const;
898 900
899 template <typename Function> 901 template <typename Function>
900 void forAllNonThrottledFrameViews(const Function&); 902 void forAllNonThrottledFrameViews(const Function&);
901 903
902 void setNeedsUpdateViewportIntersection(); 904 void setNeedsUpdateViewportIntersection();
903 void updateViewportIntersectionsForSubtree( 905 void updateViewportIntersectionsForSubtree(
904 DocumentLifecycle::LifecycleState targetState); 906 DocumentLifecycle::LifecycleState targetState);
905 void updateViewportIntersectionIfNeeded(); 907 void updateRenderThrottlingStatus(bool hidden, bool subtreeThrottled);
906 void notifyRenderThrottlingObservers();
907 void updateThrottlingStatus();
908 void notifyResizeObservers(); 908 void notifyResizeObservers();
909 909
910 // PaintInvalidationCapableScrollableArea 910 // PaintInvalidationCapableScrollableArea
911 LayoutScrollbarPart* resizer() const override { return nullptr; } 911 LayoutScrollbarPart* resizer() const override { return nullptr; }
912 912
913 bool checkLayoutInvalidationIsAllowed() const; 913 bool checkLayoutInvalidationIsAllowed() const;
914 914
915 PaintController* paintController() { return m_paintController.get(); } 915 PaintController* paintController() { return m_paintController.get(); }
916 916
917 LayoutSize m_size; 917 LayoutSize m_size;
(...skipping 21 matching lines...) Expand all
939 bool m_hasPendingLayout; 939 bool m_hasPendingLayout;
940 LayoutSubtreeRootList m_layoutSubtreeRootList; 940 LayoutSubtreeRootList m_layoutSubtreeRootList;
941 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList; 941 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList;
942 942
943 bool m_layoutSchedulingEnabled; 943 bool m_layoutSchedulingEnabled;
944 bool m_inSynchronousPostLayout; 944 bool m_inSynchronousPostLayout;
945 int m_layoutCount; 945 int m_layoutCount;
946 unsigned m_nestedLayoutCount; 946 unsigned m_nestedLayoutCount;
947 Timer<FrameView> m_postLayoutTasksTimer; 947 Timer<FrameView> m_postLayoutTasksTimer;
948 Timer<FrameView> m_updateWidgetsTimer; 948 Timer<FrameView> m_updateWidgetsTimer;
949 std::unique_ptr<CancellableTaskFactory>
950 m_renderThrottlingObserverNotificationFactory;
951 949
952 bool m_firstLayout; 950 bool m_firstLayout;
953 bool m_isTransparent; 951 bool m_isTransparent;
954 Color m_baseBackgroundColor; 952 Color m_baseBackgroundColor;
955 IntSize m_lastViewportSize; 953 IntSize m_lastViewportSize;
956 float m_lastZoomFactor; 954 float m_lastZoomFactor;
957 955
958 AtomicString m_mediaType; 956 AtomicString m_mediaType;
959 AtomicString m_mediaTypeWhenNotPrinting; 957 AtomicString m_mediaTypeWhenNotPrinting;
960 958
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 1020
1023 // Mark if something has changed in the mapping from Frame to GraphicsLayer 1021 // Mark if something has changed in the mapping from Frame to GraphicsLayer
1024 // and the Frame Timing regions should be recalculated. 1022 // and the Frame Timing regions should be recalculated.
1025 bool m_frameTimingRequestsDirty; 1023 bool m_frameTimingRequestsDirty;
1026 1024
1027 // Exists only on root frame. 1025 // Exists only on root frame.
1028 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the 1026 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the
1029 // main frame. 1027 // main frame.
1030 Member<RootFrameViewport> m_viewportScrollableArea; 1028 Member<RootFrameViewport> m_viewportScrollableArea;
1031 1029
1032 // This frame's bounds in the root frame's content coordinates, clipped
1033 // recursively through every ancestor view.
1034 IntRect m_viewportIntersection;
1035 bool m_viewportIntersectionValid;
1036
1037 // The following members control rendering pipeline throttling for this 1030 // The following members control rendering pipeline throttling for this
1038 // frame. They are only updated in response to intersection observer 1031 // frame. They are only updated in response to intersection observer
1039 // notifications, i.e., not in the middle of the lifecycle. 1032 // notifications, i.e., not in the middle of the lifecycle.
1040 bool m_hiddenForThrottling; 1033 bool m_hiddenForThrottling;
1041 bool m_crossOriginForThrottling;
1042 bool m_subtreeThrottled; 1034 bool m_subtreeThrottled;
1043 1035
1044 // Paint properties for SPv2 Only. 1036 // Paint properties for SPv2 Only.
1045 // The hierarchy of transform subtree created by a FrameView. 1037 // The hierarchy of transform subtree created by a FrameView.
1046 // [ preTranslation ] The offset from Widget::frameRect. 1038 // [ preTranslation ] The offset from Widget::frameRect.
1047 // | Establishes viewport. 1039 // | Establishes viewport.
1048 // +---[ scrollTranslation ] Frame scrolling. 1040 // +---[ scrollTranslation ] Frame scrolling.
1049 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is 1041 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is
1050 // enabled. 1042 // enabled.
1051 RefPtr<TransformPaintPropertyNode> m_preTranslation; 1043 RefPtr<TransformPaintPropertyNode> m_preTranslation;
(...skipping 10 matching lines...) Expand all
1062 1054
1063 // This is set on the local root frame view only. 1055 // This is set on the local root frame view only.
1064 DocumentLifecycle::LifecycleState m_currentUpdateLifecyclePhasesTargetState; 1056 DocumentLifecycle::LifecycleState m_currentUpdateLifecyclePhasesTargetState;
1065 1057
1066 ScrollAnchor m_scrollAnchor; 1058 ScrollAnchor m_scrollAnchor;
1067 1059
1068 bool m_needsScrollbarsUpdate; 1060 bool m_needsScrollbarsUpdate;
1069 bool m_suppressAdjustViewSize; 1061 bool m_suppressAdjustViewSize;
1070 bool m_allowsLayoutInvalidationAfterLayoutClean; 1062 bool m_allowsLayoutInvalidationAfterLayoutClean;
1071 1063
1064 Member<ElementVisibilityObserver> m_visibilityObserver;
1065
1072 // For testing. 1066 // For testing.
1073 struct ObjectPaintInvalidation { 1067 struct ObjectPaintInvalidation {
1074 String name; 1068 String name;
1075 PaintInvalidationReason reason; 1069 PaintInvalidationReason reason;
1076 }; 1070 };
1077 std::unique_ptr<Vector<ObjectPaintInvalidation>> 1071 std::unique_ptr<Vector<ObjectPaintInvalidation>>
1078 m_trackedObjectPaintInvalidations; 1072 m_trackedObjectPaintInvalidations;
1079 1073
1080 // For Slimming Paint v2 only. 1074 // For Slimming Paint v2 only.
1081 std::unique_ptr<PaintController> m_paintController; 1075 std::unique_ptr<PaintController> m_paintController;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 widget.isFrameView()); 1107 widget.isFrameView());
1114 DEFINE_TYPE_CASTS(FrameView, 1108 DEFINE_TYPE_CASTS(FrameView,
1115 ScrollableArea, 1109 ScrollableArea,
1116 scrollableArea, 1110 scrollableArea,
1117 scrollableArea->isFrameView(), 1111 scrollableArea->isFrameView(),
1118 scrollableArea.isFrameView()); 1112 scrollableArea.isFrameView());
1119 1113
1120 } // namespace blink 1114 } // namespace blink
1121 1115
1122 #endif // FrameView_h 1116 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698