Commit 339f2b44 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Make OS_NO_VALIDATION UMA calls use constant name

These metrics were being called with the histogram name based on a
conditional. This is a bug since the macro caches the histogram name.

This CL updates these calls to use a compile-time constant for each call
of the macro.

Bug: 1085032
Change-Id: I0b4f4ddec8dae1aa6337e8e6081ce636d04d1d29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210006Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770753}
parent b0d43665
......@@ -241,15 +241,21 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event,
ui::EventTimeStampFromSeconds([event timestamp]);
if (record_debug_uma) {
if (ui::EventTypeFromNative(event) == ui::ET_KEY_PRESSED) {
base::TimeDelta diff = (now - hardware_timestamp).magnitude();
if (now > hardware_timestamp) {
UMA_HISTOGRAM_CUSTOM_TIMES(
now > hardware_timestamp
? "Event.Latency.OS_NO_VALIDATION.POSITIVE.KEY_PRESSED"
: "Event.Latency.OS_NO_VALIDATION.NEGATIVE.KEY_PRESSED",
(now - hardware_timestamp).magnitude(),
"Event.Latency.OS_NO_VALIDATION.POSITIVE.KEY_PRESSED", diff,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(60), 50);
} else {
UMA_HISTOGRAM_CUSTOM_TIMES(
"Event.Latency.OS_NO_VALIDATION.NEGATIVE.KEY_PRESSED", diff,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(60), 50);
}
}
}
ui::DomCode dom_code = ui::DomCodeFromNSEvent(event);
int modifiers =
ModifiersFromEvent(event) | ui::DomCodeToWebInputEventModifiers(dom_code);
......@@ -310,13 +316,19 @@ blink::WebMouseEvent WebMouseEventBuilder::Build(
base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]);
if (ui::EventTypeFromNative(event) == ui::ET_MOUSE_PRESSED) {
base::TimeDelta diff = (now - hardware_timestamp).magnitude();
if (now > hardware_timestamp) {
UMA_HISTOGRAM_CUSTOM_TIMES(
now > hardware_timestamp
? "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_PRESSED"
: "Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_PRESSED",
(now - hardware_timestamp).magnitude(),
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
50);
"Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_PRESSED", diff,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(60), 50);
} else {
UMA_HISTOGRAM_CUSTOM_TIMES(
"Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_PRESSED", diff,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(60), 50);
}
}
blink::WebInputEvent::Type event_type =
blink::WebInputEvent::Type::kUndefined;
......@@ -430,13 +442,19 @@ blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build(
base::TimeTicks now = ui::EventTimeForNow();
base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]);
base::TimeDelta diff = (now - hardware_timestamp).magnitude();
if (now > hardware_timestamp) {
UMA_HISTOGRAM_CUSTOM_TIMES(
now > hardware_timestamp
? "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_WHEEL"
: "Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_WHEEL",
(now - hardware_timestamp).magnitude(),
"Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_WHEEL", diff,
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
50);
} else {
UMA_HISTOGRAM_CUSTOM_TIMES(
"Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_WHEEL", diff,
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
50);
}
blink::WebMouseWheelEvent result(
blink::WebInputEvent::Type::kMouseWheel, ModifiersFromEvent(event),
ui::EventTimeStampFromSeconds([event timestamp]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment