Commit 9f7dc470 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

[bfcache] Prevent caching if OomIntervention is enabled

Some background on why we sometimes need to disable bfcache:
https://docs.google.com/document/d/1NjZeusdS1kyEkZyfLggndU1A6qVt0Y1sa-LRUxnMoK8

Bug: 1001087
Change-Id: I8bded85ad30d311a6bab530b48251224f1d71b73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1939411Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarYuzu Saijo <yuzus@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Carlos Caballero <carlscab@google.com>
Cr-Commit-Position: refs/heads/master@{#719918}
parent ef9ae256
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "chrome/browser/android/oom_intervention/oom_intervention_config.h" #include "chrome/browser/android/oom_intervention/oom_intervention_config.h"
#include "chrome/browser/android/oom_intervention/oom_intervention_decider.h" #include "chrome/browser/android/oom_intervention/oom_intervention_decider.h"
#include "chrome/browser/ui/android/infobars/near_oom_reduction_infobar.h" #include "chrome/browser/ui/android/infobars/near_oom_reduction_infobar.h"
#include "content/public/browser/back_forward_cache.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
...@@ -325,6 +326,12 @@ void OomInterventionTabHelper::StartDetectionInRenderer() { ...@@ -325,6 +326,12 @@ void OomInterventionTabHelper::StartDetectionInRenderer() {
content::RenderFrameHost* main_frame = web_contents()->GetMainFrame(); content::RenderFrameHost* main_frame = web_contents()->GetMainFrame();
DCHECK(main_frame); DCHECK(main_frame);
// Connections to the renderer will not be recreated when coming out of the
// cache so prevent us from getting in there in the first place.
content::BackForwardCache::DisableForRenderFrameHost(
main_frame, "OomInterventionTabHelper");
content::RenderProcessHost* render_process_host = main_frame->GetProcess(); content::RenderProcessHost* render_process_host = main_frame->GetProcess();
DCHECK(render_process_host); DCHECK(render_process_host);
render_process_host->BindReceiver(intervention_.BindNewPipeAndPassReceiver()); render_process_host->BindReceiver(intervention_.BindNewPipeAndPassReceiver());
......
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