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

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

Issue 2773893003: Record size of scroller that user scrolls (Closed)
Patch Set: Redefine metrics using suffixes in histograms.xml 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..1b503e07ef6e136c286063407a821e42ab71c7cd 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"
@@ -221,6 +222,13 @@ WebInputEventResult ScrollManager::handleGestureScrollBegin(
passScrollGestureEvent(gestureEvent,
m_scrollGestureHandlingNode->layoutObject());
+ if (m_scrollGestureHandlingNode->layoutObject() &&
+ (gestureEvent.sourceDevice == WebGestureDeviceTouchpad ||
+ gestureEvent.sourceDevice == WebGestureDeviceTouchscreen)) {
+ recordScrollerSize(*(m_scrollGestureHandlingNode->layoutObject()),
+ gestureEvent.sourceDevice);
+ }
+
m_currentScrollChain.clear();
std::unique_ptr<ScrollStateData> scrollStateData =
WTF::makeUnique<ScrollStateData>();
@@ -559,4 +567,26 @@ bool ScrollManager::canHandleGestureEvent(
return false;
}
+void ScrollManager::recordScrollerSize(const LayoutObject& layoutObject,
+ const WebGestureDevice device) {
+ if (!layoutObject.enclosingLayer())
+ return;
+
+ if (device == WebGestureDeviceTouchpad) {
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, sizeHistogram,
tdresser 2017/03/28 13:30:12 It looks like these macros are defining a static l
yigu 2017/03/29 15:32:03 It's better we differentiate the names. There are
+ ("Event.Scroll.ScrollerSize.OnScroll_Wheel", 1, 90000, 50));
flackr 2017/03/28 14:40:23 As I mentioned in the cc file we should use consta
yigu 2017/03/29 15:32:03 500*400 makes sense to me. There is gonna be anoth
+ sizeHistogram.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ } else {
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, sizeHistogram,
+ ("Event.Scroll.ScrollerSize.OnScroll_Touch", 1, 90000, 50));
+ sizeHistogram.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698