Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5851)

Unified Diff: chromeos/dbus/dbus_thread_manager.cc

Issue 14200028: Make CrosSettings and DeviceSettingsService non Lazy instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/dbus_thread_manager.cc
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc
index cc286b547ac8164841ba185d3b9295f8cda4ad0b..95dd2432e70e0e7ffdfd7a991e7e4e7e29595987 100644
--- a/chromeos/dbus/dbus_thread_manager.cc
+++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -521,8 +521,9 @@ void DBusThreadManager::Shutdown() {
// If we called InitializeForTesting, this may get called more than once.
// Ensure that we only shutdown DBusThreadManager once.
CHECK(g_dbus_thread_manager || g_dbus_thread_manager_set_for_testing);
- delete g_dbus_thread_manager;
+ DBusThreadManager* dbus_thread_manager = g_dbus_thread_manager;
g_dbus_thread_manager = NULL;
+ delete dbus_thread_manager;
VLOG(1) << "DBusThreadManager Shutdown completed";
}
@@ -532,6 +533,17 @@ DBusThreadManager::DBusThreadManager() {
DBusThreadManager::~DBusThreadManager() {
dbus::statistics::Shutdown();
+ if (g_dbus_thread_manager == NULL)
+ return; // Called form Shutdown() or local test instance.
+ // There should never be both a global instance and a local instance.
+ CHECK(this == g_dbus_thread_manager);
+ if (g_dbus_thread_manager_set_for_testing) {
+ g_dbus_thread_manager = NULL;
+ g_dbus_thread_manager_set_for_testing = false;
+ VLOG(1) << "DBusThreadManager destroyed";
+ } else {
+ LOG(FATAL) << "~DBusThreadManager() called outside of Shutdown()";
+ }
}
// static
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698