Commit 9ec60048 authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

DumpWithoutCrashing if mouse move target is not in the specified root

This is to investigate why
|last_mouse_move_target_ != last_mouse_move_root_view_| does not
guarantee that |last_mouse_move_target_| is a child.

Bug: 851958
Change-Id: Ibe2f7aed89d83fa55dbc26af8bf995cd4fce049f
Reviewed-on: https://chromium-review.googlesource.com/1112478Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569761}
parent 9bc084d8
......@@ -150,24 +150,7 @@ void RenderWidgetHostInputEventRouter::OnRenderWidgetHostViewBaseDestroyed(
// most recent target, if possible. In some cases the parent might already
// have been destroyed, in which case the last target is cleared.
if (view != last_mouse_move_root_view_) {
// TODO(851958): Remove crash keys once we understand why the following
// attempt to get the parent can crash.
static auto* target_key = base::debug::AllocateCrashKeyString(
"failed-parent-lookup-target", base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString target_key_value(
target_key, base::StringPrintf("%p", last_mouse_move_target_));
static auto* root_key = base::debug::AllocateCrashKeyString(
"failed-parent-lookup-root", base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString root_key_value(
root_key, base::StringPrintf("%p", last_mouse_move_root_view_));
static auto* target_is_child_key = base::debug::AllocateCrashKeyString(
"failed-parent-lookup-target-is-child",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString target_is_child_key_value(
target_is_child_key,
std::to_string(
last_mouse_move_target_->IsRenderWidgetHostViewChildFrame()));
DCHECK(last_mouse_move_target_->IsRenderWidgetHostViewChildFrame());
last_mouse_move_target_ =
static_cast<RenderWidgetHostViewChildFrame*>(last_mouse_move_target_)
->GetParentView();
......@@ -691,6 +674,8 @@ void RenderWidgetHostInputEventRouter::SendMouseEnterOrLeaveEvents(
std::vector<RenderWidgetHostViewBase*> exited_views;
RenderWidgetHostViewBase* cur_view = target;
entered_views.push_back(cur_view);
// Non-root RWHVs are guaranteed to be RenderWidgetHostViewChildFrames,
// as long as they are the only embeddable RWHVs.
while (cur_view->IsRenderWidgetHostViewChildFrame()) {
cur_view =
static_cast<RenderWidgetHostViewChildFrame*>(cur_view)->GetParentView();
......@@ -703,9 +688,11 @@ void RenderWidgetHostInputEventRouter::SendMouseEnterOrLeaveEvents(
}
entered_views.push_back(cur_view);
}
// Non-root RWHVs are guaranteed to be RenderWidgetHostViewChildFrames,
// as long as they are the only embeddable RWHVs.
DCHECK_EQ(cur_view, root_view);
if (cur_view != root_view) {
ReportMouseTargetNotInRoot(cur_view, root_view);
return;
}
cur_view = last_mouse_move_target_;
if (cur_view) {
......@@ -785,6 +772,33 @@ void RenderWidgetHostInputEventRouter::SendMouseEnterOrLeaveEvents(
last_mouse_move_root_view_ = root_view;
}
void RenderWidgetHostInputEventRouter::ReportMouseTargetNotInRoot(
RenderWidgetHostViewBase* target_root,
RenderWidgetHostViewBase* specified_root) {
static auto* specified_root_is_child_key =
base::debug::AllocateCrashKeyString("mouse-outside-root-root-is-child",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString specified_root_is_child_key_value(
specified_root_is_child_key,
std::to_string(specified_root->IsRenderWidgetHostViewChildFrame()));
static auto* specified_root_is_mouse_locked_key =
base::debug::AllocateCrashKeyString(
"mouse-outside-root-root-is-mouse-locked",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString specified_root_is_mouse_locked_key_value(
specified_root_is_mouse_locked_key,
std::to_string(specified_root->IsMouseLocked()));
static auto* target_root_is_mouse_locked_key =
base::debug::AllocateCrashKeyString(
"mouse-outside-root-target-root-is-mouse-locked",
base::debug::CrashKeySize::Size32);
base::debug::ScopedCrashKeyString target_root_is_mouse_locked_key_value(
target_root_is_mouse_locked_key,
std::to_string(target_root->IsMouseLocked()));
base::debug::DumpWithoutCrashing();
}
void RenderWidgetHostInputEventRouter::ReportBubblingScrollToSameView(
const blink::WebGestureEvent& event,
const RenderWidgetHostViewBase* view) {
......
......@@ -258,6 +258,9 @@ class CONTENT_EXPORT RenderWidgetHostInputEventRouter
gfx::PointF* transformed_point,
viz::EventSource source) const;
// TODO(851958): Remove once we understand the cause of 851958.
void ReportMouseTargetNotInRoot(RenderWidgetHostViewBase* target_root,
RenderWidgetHostViewBase* specified_root);
// TODO(828422): Remove once this issue no longer occurs.
void ReportBubblingScrollToSameView(const blink::WebGestureEvent& event,
const RenderWidgetHostViewBase* view);
......
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