Bug 1638314 - Add some telemetry around wheel modifiers and triggered actions. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D76044
This commit is contained in:
Kartikaya Gupta 2020-05-22 21:21:34 +00:00
Родитель 059333687a
Коммит 5edeaf80d3
3 изменённых файлов: 48 добавлений и 5 удалений

Просмотреть файл

@ -3350,12 +3350,14 @@ nsresult EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent();
MOZ_ASSERT(wheelEvent);
WheelPrefs::Action action =
WheelPrefs::GetInstance()->RecordTelemetryAndComputeActionFor(
wheelEvent);
if (wheelEvent->mFlags.mHandledByAPZ) {
// When APZ is enabled, the actual scroll animation might be handled by
// the compositor.
WheelPrefs::Action action =
wheelEvent->mFlags.mHandledByAPZ
? WheelPrefs::ACTION_NONE
: WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent);
action = WheelPrefs::ACTION_NONE;
}
WheelDeltaAdjustmentStrategy strategy =
GetWheelDeltaAdjustmentStrategy(*wheelEvent);
@ -6203,6 +6205,18 @@ EventStateManager::WheelPrefs::ComputeActionFor(
return actions[index];
}
EventStateManager::WheelPrefs::Action
EventStateManager::WheelPrefs::RecordTelemetryAndComputeActionFor(
const WidgetWheelEvent* aEvent) {
Index index = GetIndexFor(aEvent);
Action action = ComputeActionFor(aEvent);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::WHEEL_INDEX,
(uint32_t)index);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::WHEEL_ACTION,
(uint32_t)action);
return action;
}
bool EventStateManager::WheelPrefs::NeedToComputeLineOrPageDelta(
const WidgetWheelEvent* aEvent) {
Index index = GetIndexFor(aEvent);

Просмотреть файл

@ -641,6 +641,13 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
};
Action ComputeActionFor(const WidgetWheelEvent* aEvent);
/**
* Same as ComputeActionFor, but also records telemetry probes about the
* event. This is a member of WheelPrefs mostly to avoid exposing private
* members.
*/
Action RecordTelemetryAndComputeActionFor(const WidgetWheelEvent* aEvent);
/**
* NeedToComputeLineOrPageDelta() returns if the aEvent needs to be
* computed the lineOrPageDelta values.

Просмотреть файл

@ -15209,5 +15209,27 @@
"releaseChannelCollection": "opt-out",
"bug_numbers": [1619349],
"description": "Encountered a missing character that would have been supported by a user-installed font"
},
"WHEEL_INDEX" : {
"products": ["firefox"],
"record_in_processes": ["main"],
"alert_emails": ["kgupta@mozilla.com"],
"expires_in_version": "80",
"kind" : "enumerated",
"bug_numbers": [1638314],
"description": "Keyboard modifier key applied to wheel events (WheelPrefs::Index)",
"n_values": 7,
"releaseChannelCollection": "opt-out"
},
"WHEEL_ACTION" : {
"products": ["firefox"],
"record_in_processes": ["main"],
"alert_emails": ["kgupta@mozilla.com"],
"expires_in_version": "80",
"kind" : "enumerated",
"bug_numbers": [1638314],
"description": "Action triggered by wheel event (WheelPrefs::Action)",
"n_values": 10,
"releaseChannelCollection": "opt-out"
}
}