Bug 1238137 - Telemetry pings for main thread scrollbar-driven scroll input methods. r=kats
authorBotond Ballo <botond@mozilla.com>
Fri, 05 Feb 2016 16:21:54 -0500
changeset 284392 64d7f3c393d0cab3efe7e860130f7dca0da96866
parent 284391 952873054df5068675c1fbd2f5b4a076f4138b82
child 284393 9ee50c1b09a0bb03f8c835778e832a690105d475
push id71939
push userbballo@mozilla.com
push dateTue, 16 Feb 2016 19:18:44 +0000
treeherdermozilla-inbound@6dc1883a7792 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1238137
milestone47.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 1238137 - Telemetry pings for main thread scrollbar-driven scroll input methods. r=kats
layout/xul/nsScrollbarButtonFrame.cpp
layout/xul/nsSliderFrame.cpp
--- a/layout/xul/nsScrollbarButtonFrame.cpp
+++ b/layout/xul/nsScrollbarButtonFrame.cpp
@@ -17,18 +17,21 @@
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsSliderFrame.h"
 #include "nsScrollbarFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsRepeatService.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
+#include "mozilla/Telemetry.h"
+#include "mozilla/layers/ScrollInputMethods.h"
 
 using namespace mozilla;
+using mozilla::layers::ScrollInputMethod;
 
 //
 // NS_NewToolbarFrame
 //
 // Creates a new Toolbar frame and returns it
 //
 nsIFrame*
 NS_NewScrollbarButtonFrame (nsIPresShell* aPresShell, nsStyleContext* aContext)
@@ -162,16 +165,20 @@ nsScrollbarButtonFrame::HandleButtonPres
     default:
       // We were told to ignore this click, or someone assigned a non-standard
       // value to the button's action.
       return false;
     }
     if (!weakFrame.IsAlive()) {
       return false;
     }
+
+    mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
+        (uint32_t) ScrollInputMethod::MainThreadScrollbarButtonClick);
+
     if (!m) {
       sb->MoveToNewPosition();
       if (!weakFrame.IsAlive()) {
         return false;
       }
     }
   }
   if (repeat) {
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -31,23 +31,26 @@
 #include "nsSprocketLayout.h"
 #include "nsIServiceManager.h"
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
+#include "mozilla/Telemetry.h"
 #include "mozilla/layers/AsyncDragMetrics.h"
 #include "mozilla/layers/InputAPZContext.h"
+#include "mozilla/layers/ScrollInputMethods.h"
 #include <algorithm>
 
 using namespace mozilla;
 using mozilla::layers::AsyncDragMetrics;
 using mozilla::layers::InputAPZContext;
+using mozilla::layers::ScrollInputMethod;
 
 bool nsSliderFrame::gMiddlePref = false;
 int32_t nsSliderFrame::gSnapMultiplier;
 
 // Turn this on if you want to debug slider frames.
 #undef DEBUG_SLIDER
 
 static already_AddRefed<nsIContent>
@@ -508,16 +511,19 @@ nsSliderFrame::HandleEvent(nsPresContext
 
       nscoord pos = isHorizontal ? eventPoint.x : eventPoint.y;
 
       nsIFrame* thumbFrame = mFrames.FirstChild();
       if (!thumbFrame) {
         return NS_OK;
       }
 
+      mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
+          (uint32_t) ScrollInputMethod::MainThreadScrollbarDrag);
+
       // take our current position and subtract the start location
       pos -= mDragStart;
       bool isMouseOutsideThumb = false;
       if (gSnapMultiplier) {
         nsSize thumbSize = thumbFrame->GetSize();
         if (isHorizontal) {
           // horizontal scrollbar - check if mouse is above or below thumb
           // XXXbz what about looking at the .y of the thumb's rect?  Is that
@@ -574,16 +580,19 @@ nsSliderFrame::HandleEvent(nsPresContext
     // adjust so that the middle of the thumb is placed under the click
     nsIFrame* thumbFrame = mFrames.FirstChild();
     if (!thumbFrame) {
       return NS_OK;
     }
     nsSize thumbSize = thumbFrame->GetSize();
     nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height;
 
+    mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
+        (uint32_t) ScrollInputMethod::MainThreadScrollbarTrackClick);
+
     // set it
     nsWeakFrame weakFrame(this);
     // should aMaySnap be true here?
     SetCurrentThumbPosition(scrollbar, pos - thumbLength/2, false, false);
     NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK);
 
     DragThumb(true);