Bug 1670003 - Add back the scroll input methods telemetry. r=botond

This is mostly a revert of the patch in bug 1425686 that removed the old
probe, but rebased to new code locations and clang-formatted. The histogram
entry is also updated with new bug numbers and fields.

The next patch will refine some of these telemetry recording points; the patch
is split into two for easier reviewing as this part is basically what landed
originally.

Differential Revision: https://phabricator.services.mozilla.com/D92995
This commit is contained in:
Kartikaya Gupta
2020-10-10 17:41:47 +00:00
parent 329339bd50
commit d143abb49d
13 changed files with 230 additions and 0 deletions

View File

@@ -39,6 +39,7 @@
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/Text.h"
#include "mozilla/layers/ScrollInputMethods.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsFrameSelection.h"
#include "mozilla/ErrorResult.h"
@@ -51,6 +52,7 @@
namespace mozilla {
using namespace dom;
using layers::ScrollInputMethod;
/*****************************************************************************
* TextControlElement
@@ -653,6 +655,11 @@ TextInputSelectionController::CompleteScroll(bool aForward) {
if (!mScrollFrame) {
return NS_ERROR_NOT_INITIALIZED;
}
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::MainThreadCompleteScroll);
mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::WHOLE,
ScrollMode::Instant);
return NS_OK;
@@ -704,6 +711,11 @@ TextInputSelectionController::ScrollPage(bool aForward) {
if (!mScrollFrame) {
return NS_ERROR_NOT_INITIALIZED;
}
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::MainThreadScrollPage);
mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::PAGES,
ScrollMode::Smooth);
return NS_OK;
@@ -714,6 +726,11 @@ TextInputSelectionController::ScrollLine(bool aForward) {
if (!mScrollFrame) {
return NS_ERROR_NOT_INITIALIZED;
}
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::MainThreadScrollLine);
mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::LINES,
ScrollMode::Smooth);
return NS_OK;
@@ -724,6 +741,11 @@ TextInputSelectionController::ScrollCharacter(bool aRight) {
if (!mScrollFrame) {
return NS_ERROR_NOT_INITIALIZED;
}
mozilla::Telemetry::Accumulate(
mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t)ScrollInputMethod::MainThreadScrollCharacter);
mScrollFrame->ScrollBy(nsIntPoint(aRight ? 1 : -1, 0), ScrollUnit::LINES,
ScrollMode::Smooth);
return NS_OK;