Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 1869973002: Don't leak old Activity when reparenting native pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_improvements
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index f0d546292c5f4a7945e44bae9b929d688fc0896b..e97b46e0564318540de512755ebb5dc61572254b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -1469,6 +1469,10 @@ public final class Tab implements ViewGroup.OnHierarchyChangeListener,
setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigationDelegate(this));
mAppBannerManager = mDelegateFactory.createAppBannerManager(this);
+ // Reload the NativePage (if any), since the old NativePage has a reference to the old
+ // activity.
+ maybeShowNativePage(getUrl(), true);
+
reparentingParams.finalizeTabReparenting();
}
@@ -1776,11 +1780,12 @@ public final class Tab implements ViewGroup.OnHierarchyChangeListener,
/**
* Shows a native page for url if it's a valid chrome-native URL. Otherwise, does nothing.
* @param url The url of the current navigation.
- * @param isReload Whether the current navigation is a reload.
+ * @param forceReload If true, the current native page (if any) will not be reused, even if it
+ * matches the URL.
* @return True, if a native page was displayed for url.
*/
- boolean maybeShowNativePage(String url, boolean isReload) {
- NativePage candidateForReuse = isReload ? null : getNativePage();
+ boolean maybeShowNativePage(String url, boolean forceReload) {
+ NativePage candidateForReuse = forceReload ? null : getNativePage();
NativePage nativePage = NativePageFactory.createNativePageForURL(url, candidateForReuse,
this, getTabModelSelector(), getActivity());
if (nativePage != null) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698