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,13 +241,19 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event, ...@@ -241,13 +241,19 @@ blink::WebKeyboardEvent WebKeyboardEventBuilder::Build(NSEvent* event,
ui::EventTimeStampFromSeconds([event timestamp]); ui::EventTimeStampFromSeconds([event timestamp]);
if (record_debug_uma) { if (record_debug_uma) {
if (ui::EventTypeFromNative(event) == ui::ET_KEY_PRESSED) { if (ui::EventTypeFromNative(event) == ui::ET_KEY_PRESSED) {
UMA_HISTOGRAM_CUSTOM_TIMES( base::TimeDelta diff = (now - hardware_timestamp).magnitude();
now > hardware_timestamp if (now > hardware_timestamp) {
? "Event.Latency.OS_NO_VALIDATION.POSITIVE.KEY_PRESSED" UMA_HISTOGRAM_CUSTOM_TIMES(
: "Event.Latency.OS_NO_VALIDATION.NEGATIVE.KEY_PRESSED", "Event.Latency.OS_NO_VALIDATION.POSITIVE.KEY_PRESSED", diff,
(now - hardware_timestamp).magnitude(), base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60), 50);
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); ui::DomCode dom_code = ui::DomCodeFromNSEvent(event);
...@@ -310,13 +316,19 @@ blink::WebMouseEvent WebMouseEventBuilder::Build( ...@@ -310,13 +316,19 @@ blink::WebMouseEvent WebMouseEventBuilder::Build(
base::TimeTicks hardware_timestamp = base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]); ui::EventTimeStampFromSeconds([event timestamp]);
if (ui::EventTypeFromNative(event) == ui::ET_MOUSE_PRESSED) { if (ui::EventTypeFromNative(event) == ui::ET_MOUSE_PRESSED) {
UMA_HISTOGRAM_CUSTOM_TIMES( base::TimeDelta diff = (now - hardware_timestamp).magnitude();
now > hardware_timestamp if (now > hardware_timestamp) {
? "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_PRESSED" UMA_HISTOGRAM_CUSTOM_TIMES(
: "Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_PRESSED", "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_PRESSED", diff,
(now - hardware_timestamp).magnitude(), base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60), base::TimeDelta::FromSeconds(60), 50);
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 event_type =
blink::WebInputEvent::Type::kUndefined; blink::WebInputEvent::Type::kUndefined;
...@@ -430,13 +442,19 @@ blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( ...@@ -430,13 +442,19 @@ blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build(
base::TimeTicks now = ui::EventTimeForNow(); base::TimeTicks now = ui::EventTimeForNow();
base::TimeTicks hardware_timestamp = base::TimeTicks hardware_timestamp =
ui::EventTimeStampFromSeconds([event timestamp]); ui::EventTimeStampFromSeconds([event timestamp]);
UMA_HISTOGRAM_CUSTOM_TIMES( base::TimeDelta diff = (now - hardware_timestamp).magnitude();
now > hardware_timestamp if (now > hardware_timestamp) {
? "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_WHEEL" UMA_HISTOGRAM_CUSTOM_TIMES(
: "Event.Latency.OS_NO_VALIDATION.NEGATIVE.MOUSE_WHEEL", "Event.Latency.OS_NO_VALIDATION.POSITIVE.MOUSE_WHEEL", diff,
(now - hardware_timestamp).magnitude(), base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60),
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(60), 50);
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::WebMouseWheelEvent result(
blink::WebInputEvent::Type::kMouseWheel, ModifiersFromEvent(event), blink::WebInputEvent::Type::kMouseWheel, ModifiersFromEvent(event),
ui::EventTimeStampFromSeconds([event timestamp])); 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