| Index: chrome/browser/lifetime/keep_alive_registry.cc
|
| diff --git a/chrome/browser/lifetime/keep_alive_registry.cc b/chrome/browser/lifetime/keep_alive_registry.cc
|
| index dbe7cbc26bdc149b9f1cb964fd307ae26fa5bbe9..6560d1995cd39248647ddca48799728725dd98ad 100644
|
| --- a/chrome/browser/lifetime/keep_alive_registry.cc
|
| +++ b/chrome/browser/lifetime/keep_alive_registry.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/browser/lifetime/keep_alive_registry.h"
|
|
|
| +#include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/lifetime/application_lifetime.h"
|
| #include "chrome/browser/lifetime/keep_alive_state_observer.h"
|
| #include "chrome/browser/lifetime/keep_alive_types.h"
|
| @@ -96,12 +97,17 @@ void KeepAliveRegistry::Unregister(KeepAliveOrigin origin,
|
| }
|
|
|
| void KeepAliveRegistry::OnKeepingAliveChanged(bool new_keeping_alive) {
|
| + // Should only happen in tests.
|
| + if (!g_browser_process)
|
| + return;
|
| +
|
| if (new_keeping_alive) {
|
| DVLOG(1) << "KeepAliveRegistry is now keeping the browser alive.";
|
| - chrome::IncrementKeepAliveCount();
|
| + g_browser_process->AddRefModule();
|
| } else {
|
| DVLOG(1) << "KeepAliveRegistry stopped keeping the browser alive.";
|
| - chrome::DecrementKeepAliveCount();
|
| + g_browser_process->ReleaseModule();
|
| + chrome::CloseAllBrowsersIfNeeded();
|
| }
|
| }
|
|
|
|
|