Commit 72a96aad authored by Frank Liberato's avatar Frank Liberato Committed by Chromium LUCI CQ

Check AndroidOverlayClient is_bound() before calling.

Before calling methods on the remote AndroidOverlayClient, check to
see if it's bound.  If the overlay client disconnects, sometimes we
get an invalid handle in the java client.  While it's not clear
exactly what causes this, causing a GPU crash causes the client's
handle to be cleared before the connection error handler runs.

Bug: 1155313
Change-Id: Ic9668cfb453636c23afc20156be0c69719b22c94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586768
Commit-Queue: Frank Liberato <liberato@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Auto-Submit: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837181}
parent 04762fbd
......@@ -256,16 +256,14 @@ void DialogOverlayImpl::RegisterWindowObserverIfNeeded(
static void JNI_DialogOverlayImpl_NotifyDestroyedSynchronously(
JNIEnv* env,
int message_pipe_handle) {
// TODO(crbug.com/1155313): It's entirely unclear how this could happen,
// but it's the easiest way that the call to OnSynchronouslyDestroyed might
// crash. This check will verify that it's really the problem.
CHECK_NE(static_cast<MojoHandle>(message_pipe_handle), MOJO_HANDLE_INVALID);
mojo::MessagePipeHandle handle(message_pipe_handle);
mojo::ScopedMessagePipeHandle scoped_handle(handle);
mojo::Remote<media::mojom::AndroidOverlayClient> remote(
mojo::PendingRemote<media::mojom::AndroidOverlayClient>(
std::move(scoped_handle),
media::mojom::AndroidOverlayClient::Version_));
if (!remote.is_bound())
return;
remote->OnSynchronouslyDestroyed();
// Note that we don't take back the mojo message pipe. We let it close when
// `remote` goes out of scope.
......
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