Commit 36334de1 authored by Hui Wang's avatar Hui Wang Committed by Commit Bot

android: Prevent browser hang in webview.

There has a chance that the |SynchronousCompositorProxy| will re-attach the new
compositor when the RWHWA was reused, and the |SynchronousCompositorControlHost|
will bind failed if the remote has been bound. The browser will hang when send
a |BeginFrame| through the new |SynchronousCompositorHost| but the
|BeginFrameResponse| was sent to the old host control.

Bug:1062576

Change-Id: I0bb953a265a1f1d5b8a445701702c168aa7316f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107333Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Timothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751386}
parent 71170ee8
......@@ -162,6 +162,9 @@ SynchronousCompositorHost::~SynchronousCompositorHost() {
if (outstanding_begin_frame_requests_ && begin_frame_source_)
begin_frame_source_->RemoveObserver(this);
client_->DidDestroyCompositor(this, frame_sink_id_);
// TODO(crbug.com/1062576): We should shutdown the host_control as well since
// the Host was disconnected and we should signal all the waiters that we will
// never send a |BeginFrame| and expect any |BeginFrameResponse|.
bridge_->HostDestroyedOnUIThread();
}
......
......@@ -370,6 +370,11 @@ void SynchronousCompositorProxy::BindChannel(
mojo::PendingAssociatedRemote<mojom::SynchronousCompositorHost> host,
mojo::PendingAssociatedReceiver<mojom::SynchronousCompositor>
compositor_request) {
// Reset bound mojo channels before rebinding new variants as the
// associated RenderWidgetHost may be reused.
control_host_.reset();
host_.reset();
receiver_.reset();
control_host_.Bind(std::move(control_host));
host_.Bind(std::move(host));
receiver_.Bind(std::move(compositor_request));
......
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