Bug 1105109 - ScrollInputMethod telemetry for APZ autoscrolling. r=kats
authorBotond Ballo <botond@mozilla.com>
Fri, 28 Jul 2017 16:32:42 -0400
changeset 420745 9a5b55eec89f8545a5a6d9c692311c6d13adb866
parent 420744 598ea131759fa398db351e9c0d7e31012af1c188
child 420746 2da66805c3d13861f55c84ddcb48b06da090a443
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1105109
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1105109 - ScrollInputMethod telemetry for APZ autoscrolling. r=kats MozReview-Commit-ID: 5ICwYnZTcm9
gfx/layers/apz/src/AutoscrollAnimation.cpp
gfx/layers/apz/util/ScrollInputMethods.h
--- a/gfx/layers/apz/src/AutoscrollAnimation.cpp
+++ b/gfx/layers/apz/src/AutoscrollAnimation.cpp
@@ -4,16 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "AutoscrollAnimation.h"
 
 #include <cmath>  // for sqrtf()
 
 #include "AsyncPanZoomController.h"
+#include "mozilla/Telemetry.h"                  // for Telemetry
+#include "mozilla/layers/ScrollInputMethods.h"  // for ScrollInputMethod
 
 namespace mozilla {
 namespace layers {
 
 // Helper function for AutoscrollAnimation::DoSample().
 // Basically copied as-is from toolkit/content/browser-content.js.
 static float
 Accelerate(ScreenCoord curr, ScreenCoord start)
@@ -39,16 +41,19 @@ AutoscrollAnimation::AutoscrollAnimation
 bool
 AutoscrollAnimation::DoSample(FrameMetrics& aFrameMetrics, const TimeDuration& aDelta)
 {
   APZCTreeManager* treeManager = mApzc.GetApzcTreeManager();
   if (!treeManager) {
     return false;
   }
 
+  Telemetry::Accumulate(Telemetry::SCROLL_INPUT_METHODS,
+      (uint32_t) ScrollInputMethod::ApzAutoscrolling);
+
   ScreenPoint mouseLocation = treeManager->GetCurrentMousePosition();
 
   // The implementation of this function closely mirrors that of its main-
   // thread equivalent, the autoscrollLoop() function in
   // toolkit/content/browser-content.js.
 
   // Avoid long jumps when the browser hangs for more than |maxTimeDelta| ms.
   static const TimeDuration maxTimeDelta = TimeDuration::FromMilliseconds(100);
--- a/gfx/layers/apz/util/ScrollInputMethods.h
+++ b/gfx/layers/apz/util/ScrollInputMethods.h
@@ -46,26 +46,31 @@ enum class ScrollInputMethod {
   MainThreadScrollbarButtonClick,  // clicking the buttons at the ends of the
                                    // scrollback track
   MainThreadScrollbarTrackClick,   // clicking the scrollbar track above or
                                    // below the thumb
 
   // Autoscrolling
   MainThreadAutoscrolling,    // autoscrolling
 
+  // === Additional input methods implemented in APZ ===
+
   // Async Keyboard
   ApzScrollLine,       // line scrolling
                        // (generally triggered by up/down arrow keys)
   ApzScrollCharacter,  // character scrolling
                        // (generally triggered by left/right arrow keys)
   ApzScrollPage,       // page scrolling
                        // (generally triggered by PageUp/PageDown keys)
   ApzCompleteScroll,   // scrolling to the end of the scroll range
                        // (generally triggered by Home/End keys)
 
+  // Autoscrolling
+  ApzAutoscrolling,
+
   // New input methods can be added at the end, up to a maximum of 64.
   // They should only be added at the end, to preserve the numerical values
   // of the existing enumerators.
 };
 
 } // namespace layers
 } // namespace mozilla