OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/lifetime/keep_alive_registry.h" | 5 #include "chrome/browser/lifetime/keep_alive_registry.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/lifetime/application_lifetime.h" | 8 #include "chrome/browser/lifetime/application_lifetime.h" |
9 #include "chrome/browser/lifetime/keep_alive_state_observer.h" | 9 #include "chrome/browser/lifetime/keep_alive_state_observer.h" |
10 #include "chrome/browser/lifetime/keep_alive_types.h" | 10 #include "chrome/browser/lifetime/keep_alive_types.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 OnKeepAliveStateChanged(new_keeping_alive)); | 106 OnKeepAliveStateChanged(new_keeping_alive)); |
107 } | 107 } |
108 | 108 |
109 void KeepAliveRegistry::OnRestartAllowedChanged(bool new_restart_allowed) { | 109 void KeepAliveRegistry::OnRestartAllowedChanged(bool new_restart_allowed) { |
110 DVLOG(1) << "Notifying KeepAliveStateObservers: Restart changed to: " | 110 DVLOG(1) << "Notifying KeepAliveStateObservers: Restart changed to: " |
111 << new_restart_allowed; | 111 << new_restart_allowed; |
112 FOR_EACH_OBSERVER(KeepAliveStateObserver, observers_, | 112 FOR_EACH_OBSERVER(KeepAliveStateObserver, observers_, |
113 OnKeepAliveRestartStateChanged(new_restart_allowed)); | 113 OnKeepAliveRestartStateChanged(new_restart_allowed)); |
114 } | 114 } |
115 | 115 |
116 #ifndef NDEBUG | 116 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
117 std::ostream& operator<<(std::ostream& out, const KeepAliveRegistry& registry) { | 117 std::ostream& operator<<(std::ostream& out, const KeepAliveRegistry& registry) { |
118 out << "{registered_count_=" << registry.registered_count_ | 118 out << "{registered_count_=" << registry.registered_count_ |
119 << ", restart_allowed_count_=" << registry.restart_allowed_count_ | 119 << ", restart_allowed_count_=" << registry.restart_allowed_count_ |
120 << ", KeepAlives=["; | 120 << ", KeepAlives=["; |
121 for (auto counts_per_origin_it : registry.registered_keep_alives_) { | 121 for (auto counts_per_origin_it : registry.registered_keep_alives_) { |
122 if (counts_per_origin_it != *registry.registered_keep_alives_.begin()) | 122 if (counts_per_origin_it != *registry.registered_keep_alives_.begin()) |
123 out << ", "; | 123 out << ", "; |
124 out << counts_per_origin_it.first << " (" << counts_per_origin_it.second | 124 out << counts_per_origin_it.first << " (" << counts_per_origin_it.second |
125 << ")"; | 125 << ")"; |
126 } | 126 } |
127 out << "]}"; | 127 out << "]}"; |
128 return out; | 128 return out; |
129 } | 129 } |
130 #endif // ndef NDEBUG | 130 #endif |
OLD | NEW |