Commit 540ba87f authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

weblayer: Save the stack of Tab destruction

And include the stack when on throwIfDestroyed failure to make the
message more useful.

Change-Id: I4a801d7208cb35c44bf6fbd6d58f3f424eaefd61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2561038
Auto-Submit: Bo <boliu@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831047}
parent 088b63ee
......@@ -47,6 +47,8 @@ public class Tab {
private static final Map<Integer, Tab> sTabMap = new HashMap<Integer, Tab>();
private ITab mImpl;
// Remember the stack of Tab destruction.
private Throwable mDestroyStack;
private final NavigationController mNavigationController;
private final FindInPageController mFindInPageController;
private final MediaCaptureController mMediaCaptureController;
......@@ -117,7 +119,7 @@ public class Tab {
private void throwIfDestroyed() {
if (mImpl == null) {
throw new IllegalStateException("Tab can not be used once destroyed");
throw new IllegalStateException("Tab can not be used once destroyed", mDestroyStack);
}
}
......@@ -831,6 +833,7 @@ public class Tab {
if (getTabById(mId) == this) unregisterTab(this);
mDestroyOnRemove = false;
mImpl = null;
mDestroyStack = new RuntimeException("onRemovedFromBrowser");
}
}
......@@ -903,6 +906,7 @@ public class Tab {
// Ensure that the app will fail fast if the embedder mistakenly tries to call back
// into the implementation via this Tab.
mImpl = null;
mDestroyStack = new RuntimeException("onTabDestroyed");
} else {
// This Tab should not have been destroyed yet.
assert mImpl != 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