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

Unified Diff: chrome/browser/chromeos/disks/disk_mount_manager.cc

Issue 8497007: Switch from MountLibrary to CrosDisksLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up namespace, eliminated void* Created 9 years, 1 month 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
Index: chrome/browser/chromeos/disks/disk_mount_manager.cc
diff --git a/chrome/browser/chromeos/disks/disk_mount_manager.cc b/chrome/browser/chromeos/disks/disk_mount_manager.cc
index 0e2a26b244aeab6b3dff2b5b9f8e06080712df5b..0b7b29678debdaca6e6bb7f77d614db5d4459593 100644
--- a/chrome/browser/chromeos/disks/disk_mount_manager.cc
+++ b/chrome/browser/chromeos/disks/disk_mount_manager.cc
@@ -328,7 +328,8 @@ class DiskMountManagerImpl : public DiskMountManager {
// Check if there is a formatting scheduled.
PathMap::iterator it = formatting_pending_.find(disk->device_path());
if (it != formatting_pending_.end()) {
- const std::string& file_path = it->second;
+ // Copy the string before it gets erased.
+ const std::string file_path = it->second;
formatting_pending_.erase(it);
FormatUnmountedDevice(file_path);
}
@@ -632,19 +633,34 @@ MountType DiskMountManager::MountTypeFromString(const std::string& type_str) {
// static
void DiskMountManager::Initialize() {
- VLOG(1) << "DiskMountManager::Initialize";
- DCHECK(!g_disk_mount_manager);
+ if (g_disk_mount_manager) {
+ LOG(WARNING) << "DiskMountManager was already initialized";
+ return;
+ }
g_disk_mount_manager = new DiskMountManagerImpl();
- DCHECK(g_disk_mount_manager);
+ VLOG(1) << "DiskMountManager initialized";
}
// static
-void DiskMountManager::Shutdown() {
- VLOG(1) << "DiskMountManager::Shutdown";
+void DiskMountManager::InitializeForTesting(DiskMountManager* disk_mount_manager
+ ) {
satorux1 2011/11/16 06:46:06 Hmm, this looks uglier than before.. Please change
hashimoto 2011/11/16 07:45:32 Done.
if (g_disk_mount_manager) {
- delete g_disk_mount_manager;
- g_disk_mount_manager = NULL;
+ LOG(WARNING) << "DiskMountManager was already initialized";
+ return;
+ }
+ g_disk_mount_manager = disk_mount_manager;
+ VLOG(1) << "DiskMountManager initialized";
+}
+
+// static
+void DiskMountManager::Shutdown() {
+ if (!g_disk_mount_manager) {
+ LOG(WARNING) << "DiskMountManager::Shutdown() called with NULL manager";
+ return;
}
+ delete g_disk_mount_manager;
+ g_disk_mount_manager = NULL;
+ VLOG(1) << "DiskMountManager Shutdown completed";
}
// static

Powered by Google App Engine
This is Rietveld 408576698