Commit 0d61eb50 authored by Yuzu Saijo's avatar Yuzu Saijo Committed by Commit Bot

Unbind binding_ in oom_intervention_tab_helper

This CL intends to fix a bug where renderer oom detection stops running after reloading / navigation / switching tabs. This was caused because binding_ was never unbound although it was stated as one of the requirements to start detection in renderer.

BUG=829725

Change-Id: I43507a5eb12a6206dca333be4d6d609b1c8fac72
Reviewed-on: https://chromium-review.googlesource.com/999224Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549123}
parent 386c37ac
......@@ -108,7 +108,7 @@ void OomInterventionTabHelper::AcceptIntervention() {
void OomInterventionTabHelper::DeclineIntervention() {
RecordInterventionUserDecision(false);
intervention_.reset();
ResetInterfaces();
intervention_state_ = InterventionState::DECLINED;
if (decider_) {
......@@ -125,7 +125,7 @@ void OomInterventionTabHelper::WebContentsDestroyed() {
void OomInterventionTabHelper::RenderProcessGone(
base::TerminationStatus status) {
intervention_.reset();
ResetInterfaces();
// Skip background process termination.
if (!IsLastVisibleWebContents(web_contents())) {
......@@ -167,7 +167,7 @@ void OomInterventionTabHelper::DidStartNavigation(
if (navigation_handle->IsSameDocument())
return;
intervention_.reset();
ResetInterfaces();
// Filter out background navigation.
if (!IsLastVisibleWebContents(navigation_handle->GetWebContents())) {
......@@ -259,7 +259,7 @@ void OomInterventionTabHelper::StartMonitoringIfNeeded() {
void OomInterventionTabHelper::StopMonitoring() {
if (ShouldDetectInRenderer()) {
intervention_.reset();
ResetInterfaces();
} else {
subscription_.reset();
}
......@@ -303,7 +303,7 @@ void OomInterventionTabHelper::OnNearOomDetected() {
void OomInterventionTabHelper::
OnDetectionWindowElapsedWithoutHighMemoryUsage() {
ResetInterventionState();
intervention_.reset();
ResetInterfaces();
StartMonitoringIfNeeded();
}
......@@ -312,3 +312,9 @@ void OomInterventionTabHelper::ResetInterventionState() {
intervention_state_ = InterventionState::NOT_TRIGGERED;
renderer_detection_timer_.AbandonAndStop();
}
void OomInterventionTabHelper::ResetInterfaces() {
intervention_.reset();
if (binding_.is_bound())
binding_.Close();
}
......@@ -77,6 +77,8 @@ class OomInterventionTabHelper
void ResetInterventionState();
void ResetInterfaces();
bool navigation_started_ = false;
base::Optional<base::TimeTicks> near_oom_detected_time_;
std::unique_ptr<NearOomMonitor::Subscription> subscription_;
......
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