Skip to content

Commit

Permalink
content: Dispatch pending event callbacks during InputHandler teardown
Browse files Browse the repository at this point in the history
With RenderDocument, we destroy the CompositorThreadEventQueue as a
part of detaching the InputHandler so the compositor can be reattached
to the new widget. Since this happens before the WidgetInputHandler
mojo connection is reset in the renderer, it triggers an assert that
there are no pending DispatchEventCallbacks associated with the mojo
interface.

Fix that by explicitly invoking the pending callbacks with an empty
result when the CompositorThreadEventQueue is destroyed. This is correct
because the old Widget will be destroyed immediately after the swap
finishes.

R=dtapuska@chromium.org

Bug: 1464791
Change-Id: I9726afe3ff5861eb638466a7b0c9a13ccc2a2087
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5033742
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1225218}
  • Loading branch information
khushalsagar authored and Chromium LUCI CQ committed Nov 15, 2023
1 parent d8b163a commit 376a496
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/trace_event/trace_event.h"
#include "cc/metrics/event_metrics.h"
#include "third_party/blink/public/common/input/web_input_event_attribution.h"

namespace blink {

Expand Down Expand Up @@ -44,7 +45,16 @@ bool IsContinuousGestureEvent(WebInputEvent::Type type) {

CompositorThreadEventQueue::CompositorThreadEventQueue() {}

CompositorThreadEventQueue::~CompositorThreadEventQueue() {}
CompositorThreadEventQueue::~CompositorThreadEventQueue() {
while (!queue_.empty()) {
auto event_with_callback = Pop();
event_with_callback->RunCallbacks(
InputHandlerProxy::DROP_EVENT, event_with_callback->latency_info(),
/*did_overscroll_params=*/nullptr,
/*attribution=*/WebInputEventAttribution(),
/*scroll_result_data=*/nullptr);
}
}

void CompositorThreadEventQueue::Queue(
std::unique_ptr<EventWithCallback> new_event,
Expand Down

0 comments on commit 376a496

Please sign in to comment.