Commit 16166859 authored by Yusuf Ozuysal's avatar Yusuf Ozuysal Committed by Commit Bot

Avoid trying to access UserData on destroyed tabs

This adds a static call for SuspendedTab.isShowing similar to
that of SadTab to make sure we don't call getUserData() on destroyed
tabs.

BUG=973625

Change-Id: Ib16f1991489bdf16129ac568293b0b895bb871ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700478
Commit-Queue: Yusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677123}
parent 4d146b0e
......@@ -466,7 +466,7 @@ public class TabContentManager {
}
private boolean isNativeViewShowing(Tab tab) {
return tab != null && (SadTab.isShowing(tab) || SuspendedTab.from(tab).isShowing());
return tab != null && (SadTab.isShowing(tab) || SuspendedTab.isShowing(tab));
}
// Class Object Methods
......
......@@ -38,6 +38,12 @@ public class SuspendedTab extends EmptyTabObserver implements UserData {
private static final String TAG = "SuspendedTab";
private static final Class<SuspendedTab> USER_DATA_KEY = SuspendedTab.class;
public static boolean isShowing(Tab tab) {
if (tab == null || !tab.isInitialized()) return false;
SuspendedTab suspendedTab = get(tab);
return suspendedTab != null && suspendedTab.isShowing();
}
public static SuspendedTab from(Tab tab) {
SuspendedTab suspendedTab = get(tab);
if (suspendedTab == 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