Commit 28e2fd52 authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Add diagnostic DumpWithoutCrashing to investigate gesture event hang.

We introduce a DumpWithoutCrashing when a new gesture event is queued
while acks are being processed if the processing has already lasted
over 2 seconds. This is to test the hypothesis that the queue is
getting stuck in a loop in GestureEventQueue::AckCompletedEvents.

Bug: 818214
Change-Id: I36daa488d3f5aa5e8eee5e4f442fdb3d8445c0a7
Reviewed-on: https://chromium-review.googlesource.com/959179
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543158}
parent bcb32512
......@@ -5,6 +5,8 @@
#include "content/browser/renderer_host/input/gesture_event_queue.h"
#include "base/auto_reset.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/renderer_host/input/touchpad_tap_suppression_controller.h"
#include "content/browser/renderer_host/input/touchscreen_tap_suppression_controller.h"
......@@ -159,8 +161,36 @@ bool GestureEventQueue::ShouldForwardForBounceReduction(
}
}
void GestureEventQueue::ReportPossibleHang(
const blink::WebGestureEvent& event) {
if (processing_acks_ && !did_report_hang_ &&
(base::TimeTicks::Now() - processing_acks_start_) >
base::TimeDelta::FromSeconds(2)) {
// Diagnostic for the hang in https://crbug.com/818214
static auto* type_key = base::debug::AllocateCrashKeyString(
"gesture-event-queue-hang-event-type",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString type_key_value(
type_key, std::to_string(event.GetType()));
static auto* device_key = base::debug::AllocateCrashKeyString(
"gesture-event-queue-hang-source-device",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString device_key_value(
device_key, std::to_string(event.source_device));
static auto* size_key = base::debug::AllocateCrashKeyString(
"gesture-event-queue-hang-queue-size",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString size_key_value(
size_key, std::to_string(coalesced_gesture_events_.size()));
base::debug::DumpWithoutCrashing();
did_report_hang_ = true;
}
}
void GestureEventQueue::QueueAndForwardIfNecessary(
const GestureEventWithLatencyInfo& gesture_event) {
ReportPossibleHang(gesture_event.event);
if (allow_multiple_inflight_events_) {
// Event coalescing should be handled in compositor thread event queue.
if (gesture_event.event.GetType() == WebInputEvent::kGestureFlingCancel)
......@@ -252,6 +282,7 @@ void GestureEventQueue::AckCompletedEvents() {
if (processing_acks_)
return;
base::AutoReset<bool> process_acks(&processing_acks_, true);
processing_acks_start_ = base::TimeTicks::Now();
while (!coalesced_gesture_events_.empty()) {
auto iter = coalesced_gesture_events_.begin();
if (iter->ack_state() == INPUT_EVENT_ACK_STATE_UNKNOWN)
......
......@@ -179,6 +179,9 @@ class CONTENT_EXPORT GestureEventQueue {
// remain at the head of the queue until ack'ed.
size_t EventsInFlightCount() const;
// TODO(818214): Remove once the cause of the hang is identified.
void ReportPossibleHang(const blink::WebGestureEvent& event);
// The receiver of all forwarded gesture events.
GestureEventQueueClient* client_;
......@@ -230,6 +233,12 @@ class CONTENT_EXPORT GestureEventQueue {
// taps.
FlingController fling_controller_;
// Diagnostic for the hang in https://crbug.com/818214
// Meaningful only when processing_acks_ is true.
// TODO(818214): Remove once the cause of the hang is identified.
base::TimeTicks processing_acks_start_;
bool did_report_hang_ = false;
DISALLOW_COPY_AND_ASSIGN(GestureEventQueue);
};
......
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