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 f1ed172b2c92f9140e40bc6ce28864e7dfe12da1..77c3ae3b4aaf2a337945b862a264977e709909b3 100644 |
--- a/chrome/browser/lifetime/keep_alive_registry.cc |
+++ b/chrome/browser/lifetime/keep_alive_registry.cc |
@@ -92,12 +92,14 @@ void KeepAliveRegistry::Unregister(KeepAliveOrigin origin, |
bool new_keeping_alive = IsKeepingAlive(); |
bool new_restart_allowed = IsRestartAllowed(); |
- if (new_restart_allowed != old_restart_allowed) |
- OnRestartAllowedChanged(new_restart_allowed); |
- |
+ // Update the KeepAlive state first, so that listeners can check if we are |
+ // trying to shutdown. |
if (new_keeping_alive != old_keeping_alive) |
OnKeepAliveStateChanged(new_keeping_alive); |
+ if (new_restart_allowed != old_restart_allowed) |
+ OnRestartAllowedChanged(new_restart_allowed); |
+ |
DVLOG(1) << "New state of the KeepAliveRegistry:" << *this; |
} |