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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Test that there should be no reason set if setPrefercompositingToCDLTextEnabled(true) 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 70dea6b62cb0a40ce685023b571b17b194d213e8..f1c6db34744bc375b16fb44675637ba6cc4232ef 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -195,7 +195,10 @@ FrameView::FrameView(LocalFrame& frame)
m_needsScrollbarsUpdate(false),
m_suppressAdjustViewSize(false),
m_allowsLayoutInvalidationAfterLayoutClean(true),
- m_mainThreadScrollingReasons(0) {
+ m_mainThreadScrollingReasons(0),
+ m_mainThreadScrollingReasonsCounter(
+ MainThreadScrollingReason::kMainThreadScrollingReasonCount,
+ 0) {
init();
}
@@ -4785,6 +4788,9 @@ MainThreadScrollingReasons FrameView::mainThreadScrollingReasonsPerFrame()
if (hasBackgroundAttachmentFixedObjects())
reasons |= MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
+
+ reasons |= getStyleRelatedMainThreadScrollingReasons();
+
ScrollingReasons scrollingReasons = getScrollingReasons();
const bool mayBeScrolledByInput = (scrollingReasons == Scrollable);
const bool mayBeScrolledByScript =
@@ -4849,4 +4855,27 @@ String FrameView::mainThreadScrollingReasonsAsText() const {
return result;
}
+void FrameView::adjustStyleRelatedMainThreadScrollingReasons(
+ const uint32_t reason,
+ bool increase) {
+ int index = MainThreadScrollingReason::getReasonIndex(reason);
+ DCHECK_GE(index, 0);
+ m_mainThreadScrollingReasonsCounter[index] += increase ? 1 : -1;
+ DCHECK_GE(m_mainThreadScrollingReasonsCounter[index], 0);
+}
+
+MainThreadScrollingReasons
+FrameView::getStyleRelatedMainThreadScrollingReasons() const {
+ MainThreadScrollingReasons reasons =
+ static_cast<MainThreadScrollingReasons>(0);
+ for (uint32_t reason = 1;
+ reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
+ ++reason) {
+ if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
+ reasons |= 1 << (reason - 1);
+ }
+ }
+ return reasons;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698