DumpWithoutCrashing if key repeat heuristic disagrees with native event
DumpWithoutCrashing if IsRepeated thinks a key event should have its repeat flag set but the native event says otherwise. This is unexpected, but execution is permitted to continue as it is no worse than the old behavior. If crash reports do come in, it likely means that the key repeat information from the native event was either incorrect or not preserved, which should be fixed. If no crash reports come in, then IsRepeated can be safely removed. Bug: 411681432, 40940886 Change-Id: I32dcb1e57f69966a0e75a0d775a1e196216cb272 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6473307 Reviewed-by: Hidehiko Abe <hidehiko@chromium.org> Commit-Queue: Alex Yang <aycyang@chromium.org> Cr-Commit-Position: refs/heads/main@{#1452752}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
b88866f8b6
commit
3f542c0a2a
@ -10,6 +10,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/debug/dump_without_crashing.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/metrics/histogram.h"
|
||||
@ -886,8 +887,18 @@ void KeyEvent::InitializeNative() {
|
||||
|
||||
// Check if this is a key repeat. This must be called before initial flags
|
||||
// processing, e.g: NormalizeFlags(), to avoid issues like crbug.com/1069690.
|
||||
if (synthesize_key_repeat_enabled_ && IsRepeated(GetLastKeyEvent()))
|
||||
if (synthesize_key_repeat_enabled_ && IsRepeated(GetLastKeyEvent())) {
|
||||
if (!(flags() & EF_IS_REPEAT)) {
|
||||
// If this branch is reached, it means that IsRepeated thinks this should
|
||||
// be a repeat key event, while the native event repeat information was
|
||||
// either incorrect or not preserved. This is unexpected, but execution
|
||||
// is permitted to continue as it is no worse than the old behavior.
|
||||
// TODO(https://crbug.com/411681432) Remove IsRepeated once it is deemed
|
||||
// strictly redundant.
|
||||
base::debug::DumpWithoutCrashing();
|
||||
}
|
||||
SetFlags(flags() | EF_IS_REPEAT);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
NormalizeFlags();
|
||||
|
Reference in New Issue
Block a user