Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index 20c24c2d600a24530ff17f1fba9dbee275a23425..12e658bee619c6abd9f161af5d9551f39a7a8ac4 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -705,6 +705,15 @@ public class ContentViewCore |
mWebContentsObserver = new WebContentsObserver(mWebContents) { |
@Override |
+ public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode, |
+ String description, String failingUrl) { |
+ // Navigation that fails the provisional load will have the strong binding removed |
+ // here. One for which the provisional load is commited will have the strong binding |
+ // removed in navigationEntryCommitted() below. |
+ if (isProvisionalLoad) determinedProcessVisibility(); |
+ } |
+ |
+ @Override |
public void didNavigateMainFrame(String url, String baseUrl, |
boolean isNavigationToDifferentPage, boolean isFragmentNavigation) { |
if (!isNavigationToDifferentPage) return; |
@@ -720,6 +729,19 @@ public class ContentViewCore |
// No need to reset gesture detection as the detector will have |
// been destroyed in the RenderWidgetHostView. |
} |
+ |
+ @Override |
+ public void navigationEntryCommitted() { |
+ determinedProcessVisibility(); |
+ } |
+ |
+ private void determinedProcessVisibility() { |
+ // Signal to the process management logic that we can now rely on the process |
+ // visibility signal for binding management. Before the navigation commits, its |
+ // renderer is considered background even if the pending navigation happens in the |
+ // foreground renderer. |
+ ChildProcessLauncher.determinedVisibility(getCurrentRenderProcessId()); |
+ } |
}; |
} |
@@ -1270,7 +1292,6 @@ public class ContentViewCore |
* @return The ID of the renderer process that backs this tab or |
* {@link #INVALID_RENDER_PROCESS_PID} if there is none. |
*/ |
- @VisibleForTesting |
public int getCurrentRenderProcessId() { |
return nativeGetCurrentRenderProcessId(mNativeContentViewCore); |
} |