Commit 14aa2e0e authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix crash with MojoInputMessages

Once WillShutdown is called the InputHandlerProxy object should be destroyed
since it is no longer valid.

BUG=775483

Change-Id: I3dc1cf7d7295ff08bbcec3d8ee2b12690961af2e
Reviewed-on: https://chromium-review.googlesource.com/725860Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509894}
parent e7b20f85
......@@ -132,7 +132,9 @@ void WidgetInputHandlerManager::AddInterface(
}
}
void WidgetInputHandlerManager::WillShutdown() {}
void WidgetInputHandlerManager::WillShutdown() {
input_handler_proxy_.reset();
}
void WidgetInputHandlerManager::TransferActiveWheelFlingAnimation(
const blink::WebActiveWheelFlingParameters& params) {
......@@ -243,7 +245,14 @@ void WidgetInputHandlerManager::ObserveGestureEventOnMainThread(
void WidgetInputHandlerManager::DispatchEvent(
std::unique_ptr<content::InputEvent> event,
mojom::WidgetInputHandler::DispatchEventCallback callback) {
if (!event || !event->web_event) {
if (!event || !event->web_event || !input_handler_proxy_) {
// Call |callback| if it was available indicating this event wasn't
// handled.
if (callback) {
std::move(callback).Run(
InputEventAckSource::MAIN_THREAD, ui::LatencyInfo(),
INPUT_EVENT_ACK_STATE_NOT_CONSUMED, base::nullopt, base::nullopt);
}
return;
}
......@@ -372,7 +381,7 @@ void WidgetInputHandlerManager::HandledInputEvent(
touch_action));
} else {
std::move(callback).Run(
InputEventAckSource::COMPOSITOR_THREAD, latency_info, ack_state,
InputEventAckSource::MAIN_THREAD, latency_info, ack_state,
overscroll_params
? base::Optional<ui::DidOverscrollParams>(*overscroll_params)
: base::nullopt,
......@@ -383,6 +392,8 @@ void WidgetInputHandlerManager::HandledInputEvent(
void WidgetInputHandlerManager::ObserveGestureEventOnCompositorThread(
const blink::WebGestureEvent& gesture_event,
const cc::InputHandlerScrollResult& scroll_result) {
if (!input_handler_proxy_)
return;
DCHECK(input_handler_proxy_->scroll_elasticity_controller());
input_handler_proxy_->scroll_elasticity_controller()
->ObserveGestureEventAndResult(gesture_event, scroll_result);
......
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