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..066f0e55acea07f17b982c8039c0779e1246245c 100644 |
--- a/chrome/browser/chromeos/disks/disk_mount_manager.cc |
+++ b/chrome/browser/chromeos/disks/disk_mount_manager.cc |
@@ -328,7 +328,7 @@ 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; |
+ const std::string file_path = it->second; |
hashimoto
2011/11/15 12:39:25
Using const std::string& is wrong because |it| is
satorux1
2011/11/15 21:20:24
oops. that was tricky! please add a comment just i
hashimoto
2011/11/16 04:28:15
Done.
|
formatting_pending_.erase(it); |
FormatUnmountedDevice(file_path); |
} |
@@ -632,19 +632,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/15 21:20:24
you can move the parameter to the previous line.
hashimoto
2011/11/16 04:28:15
Done.
But the line is too long to make the left br
|
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 |