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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.h

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Add unit test && refactoring Created 4 years 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 void enqueueScrollAnchoringAdjustment(ScrollableArea*); 760 void enqueueScrollAnchoringAdjustment(ScrollableArea*);
761 void performScrollAnchoringAdjustments(); 761 void performScrollAnchoringAdjustments();
762 762
763 // For PaintInvalidator temporarily. TODO(wangxianzhu): Move into 763 // For PaintInvalidator temporarily. TODO(wangxianzhu): Move into
764 // PaintInvalidator. 764 // PaintInvalidator.
765 void invalidatePaintIfNeeded(const PaintInvalidationState&); 765 void invalidatePaintIfNeeded(const PaintInvalidationState&);
766 766
767 // Only for SPv2. 767 // Only for SPv2.
768 std::unique_ptr<JSONObject> compositedLayersAsJSON(LayerTreeFlags); 768 std::unique_ptr<JSONObject> compositedLayersAsJSON(LayerTreeFlags);
769 769
770 inline int reasonIndex(uint32_t reason) const {
bokan 2016/12/13 14:38:57 inline unneeded, this is inline by virtue of being
bokan 2016/12/13 14:38:57 This should move as a helper into MainThreadScroll
yigu 2016/12/13 20:54:10 Done.
yigu 2016/12/13 20:54:10 Done.
771 if (!reason || reason & (reason - 1))
772 return 0;
773 int power = 0;
774 while (reason > 0) {
775 reason = reason >> 1;
776 ++power;
777 }
778 return power;
779 }
780
781 void adjustMainThreadReasonsDueToLayoutObject(uint32_t reason, bool increase);
bokan 2016/12/13 14:38:56 IMO, this should be called adjustMainThreadReasons
yigu 2016/12/13 20:54:10 Done.
782
783 MainThreadScrollingReasons checkMainThreadScrollingReasonDueToLayoutObject();
bokan 2016/12/13 14:38:56 check->get, Reason->Reasons
yigu 2016/12/13 20:54:10 Done.
784
770 protected: 785 protected:
771 // Scroll the content via the compositor. 786 // Scroll the content via the compositor.
772 bool scrollContentsFastPath(const IntSize& scrollDelta); 787 bool scrollContentsFastPath(const IntSize& scrollDelta);
773 788
774 // Scroll the content by invalidating everything. 789 // Scroll the content by invalidating everything.
775 void scrollContentsSlowPath(); 790 void scrollContentsSlowPath();
776 791
777 ScrollBehavior scrollBehaviorStyle() const override; 792 ScrollBehavior scrollBehaviorStyle() const override;
778 793
779 void scrollContentsIfNeeded(); 794 void scrollContentsIfNeeded();
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 struct ObjectPaintInvalidation { 1140 struct ObjectPaintInvalidation {
1126 String name; 1141 String name;
1127 PaintInvalidationReason reason; 1142 PaintInvalidationReason reason;
1128 }; 1143 };
1129 std::unique_ptr<Vector<ObjectPaintInvalidation>> 1144 std::unique_ptr<Vector<ObjectPaintInvalidation>>
1130 m_trackedObjectPaintInvalidations; 1145 m_trackedObjectPaintInvalidations;
1131 1146
1132 // For Slimming Paint v2 only. 1147 // For Slimming Paint v2 only.
1133 std::unique_ptr<PaintController> m_paintController; 1148 std::unique_ptr<PaintController> m_paintController;
1134 std::unique_ptr<PaintArtifactCompositor> m_paintArtifactCompositor; 1149 std::unique_ptr<PaintArtifactCompositor> m_paintArtifactCompositor;
1150
1151 // For recording main thread scrolling reasons
1152 // due to layout object properties. e.g. opacity, transform.
1153 // The size of the vector depends on the number of
1154 // main thread scrolling reasons.
1155 Vector<int> m_mainThreadScrollingReasonLayoutCounter;
bokan 2016/12/13 14:38:57 My read is that this vector is tracking scrolling
yigu 2016/12/13 20:54:10 Done.
1135 }; 1156 };
1136 1157
1137 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) { 1158 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) {
1138 if (m_isVisuallyNonEmpty) 1159 if (m_isVisuallyNonEmpty)
1139 return; 1160 return;
1140 m_visuallyNonEmptyCharacterCount += count; 1161 m_visuallyNonEmptyCharacterCount += count;
1141 // Use a threshold value to prevent very small amounts of visible content from 1162 // Use a threshold value to prevent very small amounts of visible content from
1142 // triggering didMeaningfulLayout. The first few hundred characters rarely 1163 // triggering didMeaningfulLayout. The first few hundred characters rarely
1143 // contain the interesting content of the page. 1164 // contain the interesting content of the page.
1144 static const unsigned visualCharacterThreshold = 200; 1165 static const unsigned visualCharacterThreshold = 200;
(...skipping 20 matching lines...) Expand all
1165 widget.isFrameView()); 1186 widget.isFrameView());
1166 DEFINE_TYPE_CASTS(FrameView, 1187 DEFINE_TYPE_CASTS(FrameView,
1167 ScrollableArea, 1188 ScrollableArea,
1168 scrollableArea, 1189 scrollableArea,
1169 scrollableArea->isFrameView(), 1190 scrollableArea->isFrameView(),
1170 scrollableArea.isFrameView()); 1191 scrollableArea.isFrameView());
1171 1192
1172 } // namespace blink 1193 } // namespace blink
1173 1194
1174 #endif // FrameView_h 1195 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698