Chromium Code Reviews| 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 f61ef82706df2cd271f97e0e78fa3266f35d7a13..09cc05dd6b32ae439766b4d384b427bc25f3926b 100644 |
| --- a/chrome/browser/lifetime/keep_alive_registry.cc |
| +++ b/chrome/browser/lifetime/keep_alive_registry.cc |
| @@ -4,6 +4,8 @@ |
| #include "chrome/browser/lifetime/keep_alive_registry.h" |
| +#include <sstream> |
| + |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/lifetime/application_lifetime.h" |
| #include "chrome/browser/lifetime/keep_alive_state_observer.h" |
| @@ -67,6 +69,12 @@ bool KeepAliveRegistry::WouldRestartWithout( |
| return registered_count == restart_allowed_count; |
| } |
| +std::string KeepAliveRegistry::ToString() const { |
| + std::stringstream stream; |
| + stream << *this; |
|
sky
2017/03/22 03:56:16
Are you sure this returns something helpful?
|
| + return stream.str(); |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // Private methods |
| @@ -74,7 +82,9 @@ KeepAliveRegistry::KeepAliveRegistry() |
| : registered_count_(0), restart_allowed_count_(0) {} |
| KeepAliveRegistry::~KeepAliveRegistry() { |
| - DLOG_IF(ERROR, registered_count_ > 0 || registered_keep_alives_.size() > 0) |
| + // TODO(sammiequon): Change all VLOGS back to DVLOGS in this file once |
| + // crbug.com/660962 is resolved. |
| + VLOG_IF(1, registered_count_ > 0 || registered_keep_alives_.size() > 0) |
|
sky
2017/03/22 03:56:16
!empty()
|
| << "KeepAliveRegistry not empty at destruction time. State:" << *this; |
| } |
| @@ -102,7 +112,7 @@ void KeepAliveRegistry::Register(KeepAliveOrigin origin, |
| if (new_restart_allowed != old_restart_allowed) |
| OnRestartAllowedChanged(new_restart_allowed); |
| - DVLOG(1) << "New state of the KeepAliveRegistry: " << *this; |
| + VLOG(1) << "New state of the KeepAliveRegistry: " << *this; |
| } |
| void KeepAliveRegistry::Unregister(KeepAliveOrigin origin, |
| @@ -130,19 +140,19 @@ void KeepAliveRegistry::Unregister(KeepAliveOrigin origin, |
| if (new_restart_allowed != old_restart_allowed) |
| OnRestartAllowedChanged(new_restart_allowed); |
| - DVLOG(1) << "New state of the KeepAliveRegistry:" << *this; |
| + VLOG(1) << "New state of the KeepAliveRegistry:" << *this; |
| } |
| void KeepAliveRegistry::OnKeepAliveStateChanged(bool new_keeping_alive) { |
| - DVLOG(1) << "Notifying KeepAliveStateObservers: KeepingAlive changed to: " |
| - << new_keeping_alive; |
| + VLOG(1) << "Notifying KeepAliveStateObservers: KeepingAlive changed to: " |
| + << new_keeping_alive; |
| for (KeepAliveStateObserver& observer : observers_) |
| observer.OnKeepAliveStateChanged(new_keeping_alive); |
| } |
| void KeepAliveRegistry::OnRestartAllowedChanged(bool new_restart_allowed) { |
| - DVLOG(1) << "Notifying KeepAliveStateObservers: Restart changed to: " |
| - << new_restart_allowed; |
| + VLOG(1) << "Notifying KeepAliveStateObservers: Restart changed to: " |
| + << new_restart_allowed; |
| for (KeepAliveStateObserver& observer : observers_) |
| observer.OnKeepAliveRestartStateChanged(new_restart_allowed); |
| } |