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

Unified Diff: third_party/WebKit/Source/core/input/ScrollManager.cpp

Issue 2773593005: Move logic of recording main thread scrolling reasons from cc to blink::ScrollManager (Closed)
Patch Set: Bug fix Created 3 years, 9 months 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/input/ScrollManager.cpp
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp
index 6d05fe059f6f8a7ddb8b1370866f43cd5abda5ea..b2f462537c383bd43f809732ecaa11c2a59bfa7c 100644
--- a/third_party/WebKit/Source/core/input/ScrollManager.cpp
+++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -22,6 +22,7 @@
#include "core/page/scrolling/RootScrollerController.h"
#include "core/page/scrolling/ScrollState.h"
#include "core/paint/PaintLayer.h"
+#include "platform/Histogram.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/PtrUtil.h"
@@ -196,6 +197,56 @@ void ScrollManager::customizedScroll(const Node& startNode,
scrollState.distributeToScrollChainDescendant();
}
+uint32_t ScrollManager::computeNonCompositedMainThreadScrollingReasons() {
+ if (!m_scrollGestureHandlingNode->layoutObject())
+ return 0;
+ uint32_t reasons = 0;
+ LayoutBox* curBox =
+ m_scrollGestureHandlingNode->layoutObject()->enclosingBox();
+ while (curBox) {
+ if (auto* scrollableArea = curBox->getScrollableArea()) {
+ if (scrollableArea->isScrollable()) {
bokan 2017/03/28 15:30:15 On second look, I don't think this is enough. If w
tdresser 2017/03/28 17:10:22 Can you describe with a bit more detail how we'd i
bokan 2017/03/28 18:23:02 We do this walk up the containingBlock chain until
tdresser 2017/03/28 19:25:14 Thanks. Yeah, considering that bucket separately S
+ reasons = scrollableArea->getNonCompositedMainThreadScrollingReasons();
+ break;
+ }
+ }
+ curBox = curBox->containingBlock();
+ }
+ return reasons;
+}
+
+void ScrollManager::recordNonCompositedMainThreadScrollingReasons(
+ const WebGestureDevice device) {
+ if (device != WebGestureDeviceTouchpad &&
+ device != WebGestureDeviceTouchscreen) {
+ return;
+ }
+
+ uint32_t reasons = computeNonCompositedMainThreadScrollingReasons();
+ if (!reasons)
+ return;
+
+ uint32_t mainThreadScrollingReasonEnumMax =
+ MainThreadScrollingReason::kMainThreadScrollingReasonCount + 1;
+ for (uint32_t i = 0;
+ i < MainThreadScrollingReason::kMainThreadScrollingReasonCount; ++i) {
+ unsigned val = 1 << i;
+ if (reasons & val) {
+ if (device == WebGestureDeviceTouchscreen) {
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, touchHistogram,
+ ("Renderer4.MainThreadGestureScrollReason",
+ mainThreadScrollingReasonEnumMax));
+ touchHistogram.count(i + 1);
+ } else {
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, wheelHistogram,
+ ("Renderer4.MainThreadWheelScrollReason",
+ mainThreadScrollingReasonEnumMax));
+ wheelHistogram.count(i + 1);
+ }
+ }
+ }
+}
+
WebInputEventResult ScrollManager::handleGestureScrollBegin(
const WebGestureEvent& gestureEvent) {
Document* document = m_frame->document();
@@ -221,6 +272,8 @@ WebInputEventResult ScrollManager::handleGestureScrollBegin(
passScrollGestureEvent(gestureEvent,
m_scrollGestureHandlingNode->layoutObject());
+ recordNonCompositedMainThreadScrollingReasons(gestureEvent.sourceDevice);
+
m_currentScrollChain.clear();
std::unique_ptr<ScrollStateData> scrollStateData =
WTF::makeUnique<ScrollStateData>();

Powered by Google App Engine
This is Rietveld 408576698