Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1163)

Unified Diff: content/browser/renderer_host/render_widget_host_input_event_router.cc

Issue 1783533002: Add code to collect crash data for https://crbug.com/592319. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_input_event_router.cc
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc
index 0343bd97aaba02d54a0b59a37886b6cb09b954fa..0b4af7622d2939403678a4aca5ba76245b3219b6 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.cc
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -4,6 +4,7 @@
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
+#include "base/debug/dump_without_crashing.h"
#include "cc/quads/surface_draw_quad.h"
#include "cc/surfaces/surface_id_allocator.h"
#include "cc/surfaces/surface_manager.h"
@@ -90,7 +91,16 @@ bool RenderWidgetHostInputEventRouter::HittestDelegate::AcceptHitTarget(
RenderWidgetHostInputEventRouter::RenderWidgetHostInputEventRouter()
: touch_target_(nullptr),
gesture_target_(nullptr),
- active_touches_(0) {}
+ active_touches_(0),
+ number_of_gesture_targets_enqueued_(0),
+ number_of_gesture_targets_dequeued_(0),
+ last_gesture_event_index_(0),
+ last_touch_event_index_(0) {
+ for (unsigned i = 0; i < kNumLastEventTypes; ++i) {
+ last_gesture_event_types_[i] = blink::WebInputEvent::Undefined;
+ last_touch_event_types_[i] = blink::WebInputEvent::Undefined;
+ }
+}
RenderWidgetHostInputEventRouter::~RenderWidgetHostInputEventRouter() {
// We may be destroyed before some of the owners in the map, so we must
@@ -170,13 +180,28 @@ void RenderWidgetHostInputEventRouter::RouteGestureEvent(
// GestureTapDown is sent to the previous target, in case it is still in a
// fling.
if (event->type == blink::WebInputEvent::GestureTapDown) {
- DCHECK(!gesture_target_queue_.empty());
+ if (gesture_target_queue_.empty()) {
+ // Collect data to assist debugging https://crbug.com/592319.
+ // We'll assume for now if there's no target that we should just ignore
+ // the event.
+ LOG(ERROR) << "Gesture sequence start detected with no target available.";
+ base::debug::DumpWithoutCrashing();
+ return;
+ }
+
const GestureTargetData& data = gesture_target_queue_.front();
gesture_target_ = data.target;
gesture_delta_ = data.delta;
gesture_target_queue_.pop_front();
+ // Code to assist debugging https://crbug.com/592319.
+ number_of_gesture_targets_dequeued_++;
}
+ // Code to assist debugging https://crbug.com/592319.
+ last_gesture_event_types_[last_gesture_event_index_] = event->type;
+ last_gesture_event_index_ =
+ (last_gesture_event_index_ + 1) % kNumLastEventTypes;
tdresser 2016/03/09 19:53:45 Based on the code here, isn't last_gesture_event_i
wjmaclean 2016/03/09 21:28:31 Done.
+
if (!gesture_target_)
return;
@@ -189,6 +214,11 @@ void RenderWidgetHostInputEventRouter::RouteTouchEvent(
RenderWidgetHostViewBase* root_view,
blink::WebTouchEvent* event,
const ui::LatencyInfo& latency) {
+ // Code to assist debugging https://crbug.com/592319.
+ last_touch_event_types_[last_touch_event_index_] = event->type;
+ last_touch_event_index_ =
+ (last_touch_event_index_ + 1) % kNumLastEventTypes;
tdresser 2016/03/09 19:53:45 Looks like this is next_touch_event_index_.
wjmaclean 2016/03/09 21:28:31 Done.
+
switch (event->type) {
case blink::WebInputEvent::TouchStart: {
if (!active_touches_) {
@@ -208,6 +238,8 @@ void RenderWidgetHostInputEventRouter::RouteTouchEvent(
// for the duration of the sequence.
touch_delta_ = transformed_point - original_point;
gesture_target_queue_.emplace_back(touch_target_, touch_delta_);
+ // Code to assist debugging https://crbug.com/592319.
+ number_of_gesture_targets_enqueued_++;
if (!touch_target_)
return;

Powered by Google App Engine
This is Rietveld 408576698