Bug 1105109 - ScrollInputMethod telemetry for APZ autoscrolling. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Fri, 28 Jul 2017 16:32:42 -0400
changeset 618567 ab29eb3d0d9dc83daa5843e4cef66fe58d9d2267
parent 618566 a85b20059ae904cc18241e128974bbe8ee060468
child 640115 c9cc066a86506ecc0a0fbe510cf58814577cb0f4
push id71381
push userbballo@mozilla.com
push dateMon, 31 Jul 2017 18:42:38 +0000
reviewerskats
bugs1105109
milestone56.0a1
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