Commit 7143f8b2 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

oom_intervention: Check OomInterventionHost binding in StartMonitoringIfNeeded()

When we observe high memory usage in renderer process, |binding_| could
be already bound when StartMonitoringIfNeeded() is called. Check if it
is already bound in StartMonitoringIfNeeded().

Bug: 817873
Change-Id: I4c75b48471a7de839fd2a159edf5f87db89c8c1d
Reviewed-on: https://chromium-review.googlesource.com/954892Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541756}
parent 2418cebb
...@@ -247,6 +247,8 @@ void OomInterventionTabHelper::StartMonitoringIfNeeded() { ...@@ -247,6 +247,8 @@ void OomInterventionTabHelper::StartMonitoringIfNeeded() {
return; return;
if (ShouldDetectInRenderer()) { if (ShouldDetectInRenderer()) {
if (binding_.is_bound())
return;
StartDetectionInRenderer(); StartDetectionInRenderer();
} else { } else {
subscription_ = NearOomMonitor::GetInstance()->RegisterCallback( subscription_ = NearOomMonitor::GetInstance()->RegisterCallback(
...@@ -277,6 +279,7 @@ void OomInterventionTabHelper::StartDetectionInRenderer() { ...@@ -277,6 +279,7 @@ void OomInterventionTabHelper::StartDetectionInRenderer() {
DCHECK(render_process_host); DCHECK(render_process_host);
content::BindInterface(render_process_host, content::BindInterface(render_process_host,
mojo::MakeRequest(&intervention_)); mojo::MakeRequest(&intervention_));
DCHECK(!binding_.is_bound());
blink::mojom::OomInterventionHostPtr host; blink::mojom::OomInterventionHostPtr host;
binding_.Bind(mojo::MakeRequest(&host)); binding_.Bind(mojo::MakeRequest(&host));
intervention_->StartDetection(std::move(host), trigger_intervention); intervention_->StartDetection(std::move(host), trigger_intervention);
......
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