| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/application_lifetime.h" | 5 #include "chrome/browser/lifetime/application_lifetime.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // there is nothing to do. | 301 // there is nothing to do. |
| 302 if (!g_browser_process) return; | 302 if (!g_browser_process) return; |
| 303 | 303 |
| 304 // Allow the app to shutdown again. | 304 // Allow the app to shutdown again. |
| 305 if (!WillKeepAlive()) { | 305 if (!WillKeepAlive()) { |
| 306 g_browser_process->ReleaseModule(); | 306 g_browser_process->ReleaseModule(); |
| 307 CloseAllBrowsersIfNeeded(); | 307 CloseAllBrowsersIfNeeded(); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 int GetKeepAliveCountForTesting() { |
| 312 return g_keep_alive_count; |
| 313 } |
| 314 |
| 311 bool WillKeepAlive() { | 315 bool WillKeepAlive() { |
| 312 return g_keep_alive_count > 0; | 316 return g_keep_alive_count > 0; |
| 313 } | 317 } |
| 314 #endif // !defined(OS_ANDROID) | 318 #endif // !defined(OS_ANDROID) |
| 315 | 319 |
| 316 void NotifyAppTerminating() { | 320 void NotifyAppTerminating() { |
| 317 static bool notified = false; | 321 static bool notified = false; |
| 318 if (notified) | 322 if (notified) |
| 319 return; | 323 return; |
| 320 notified = true; | 324 notified = true; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 376 } |
| 373 | 377 |
| 374 void DisableShutdownForTesting(bool disable_shutdown_for_testing) { | 378 void DisableShutdownForTesting(bool disable_shutdown_for_testing) { |
| 375 g_disable_shutdown_for_testing = disable_shutdown_for_testing; | 379 g_disable_shutdown_for_testing = disable_shutdown_for_testing; |
| 376 if (!g_disable_shutdown_for_testing && !WillKeepAlive()) | 380 if (!g_disable_shutdown_for_testing && !WillKeepAlive()) |
| 377 CloseAllBrowsersIfNeeded(); | 381 CloseAllBrowsersIfNeeded(); |
| 378 } | 382 } |
| 379 #endif // !defined(OS_ANDROID) | 383 #endif // !defined(OS_ANDROID) |
| 380 | 384 |
| 381 } // namespace chrome | 385 } // namespace chrome |
| OLD | NEW |