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

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: NEW! 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..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

Powered by Google App Engine
This is Rietveld 408576698