Commit 84fbaf84 authored by Yuzu Saijo's avatar Yuzu Saijo Committed by Commit Bot

OomIntervention opt-out should work properly with 'show original'

OomIntervention should not be re-triggered on the same page if the user declines the intervention once.
This CL fixes the bug.

Bug: 889131, 887119
Change-Id: Idb9eebb2bb9f79756b63f0e010fe018ba5c490e8
Reviewed-on: https://chromium-review.googlesource.com/1245019
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594574}
parent 5358dbe0
......@@ -300,6 +300,8 @@ void OomInterventionTabHelper::StartDetectionInRenderer() {
}
}
if (!renderer_pause_enabled && !navigate_ads_enabled)
return;
content::RenderFrameHost* main_frame = web_contents()->GetMainFrame();
DCHECK(main_frame);
content::RenderProcessHost* render_process_host = main_frame->GetProcess();
......
......@@ -53,6 +53,7 @@ OomInterventionMetrics OomInterventionImpl::GetCurrentMemoryMetrics() {
void OomInterventionImpl::Check(TimerBase*) {
DCHECK(host_);
DCHECK(renderer_pause_enabled_ || navigate_ads_enabled_);
OomInterventionMetrics current_memory = GetCurrentMemoryMetrics();
bool oom_detected = false;
......
......@@ -242,8 +242,8 @@ TEST_F(OomInterventionImplTest, CalculateProcessFootprint) {
MockOomInterventionHost mock_host(mojo::MakeRequest(&host_ptr));
mojom::blink::DetectionArgsPtr args(mojom::blink::DetectionArgs::New());
intervention_->StartDetection(std::move(host_ptr), std::move(args),
false /*renderer_pause_enabled*/,
false /*navigate_ads_enabled*/);
true /*renderer_pause_enabled*/,
true /*navigate_ads_enabled*/);
// Create unsafe shared memory region to write metrics in reporter.
base::UnsafeSharedMemoryRegion shm =
base::UnsafeSharedMemoryRegion::Create(sizeof(OomInterventionMetrics));
......
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