Commit d1414246 authored by liberato@chromium.org's avatar liberato@chromium.org Committed by Commit Bot

Close AndroidOverlay client to prevent leaked mojo routers.

Previously, DialogOverlayImpl did not close the overlay client when
cleaning up.  This caused the mojo router in |mClient| to be closed
only when the client was GC'd, and issued warnings in logcat.

Now, DialogOverlayImpl closes |mClient| properly.

AndroidOverlayProviderImpl also closes the client if it fails before
providing the client to a DialogOverlayImpl.

Bug: 822798
Change-Id: I57657b4e1bc77e07e79a1182c5467e243d947002
Reviewed-on: https://chromium-review.googlesource.com/966868Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543770}
parent edee20eb
...@@ -66,6 +66,7 @@ public class AndroidOverlayProviderImpl implements AndroidOverlayProvider { ...@@ -66,6 +66,7 @@ public class AndroidOverlayProviderImpl implements AndroidOverlayProvider {
// Limit the number of concurrent surfaces. // Limit the number of concurrent surfaces.
if (mNumOverlays >= MAX_OVERLAYS) { if (mNumOverlays >= MAX_OVERLAYS) {
client.onDestroyed(); client.onDestroyed();
client.close();
return; return;
} }
......
...@@ -309,6 +309,8 @@ public class DialogOverlayImpl implements AndroidOverlay, DialogOverlayCore.Host ...@@ -309,6 +309,8 @@ public class DialogOverlayImpl implements AndroidOverlay, DialogOverlayCore.Host
mDialogCore = null; mDialogCore = null;
// If we wanted to send any message to |mClient|, we should have done so already. // If we wanted to send any message to |mClient|, we should have done so already.
// We close |mClient| first to prevent leaking the mojo router object.
if (mClient != null) mClient.close();
mClient = null; mClient = null;
} }
......
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