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

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: Rebased on ToT 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..5e10c58f2ebfd6e66b8b857000ebc06a5f64fce2 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) {
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
« no previous file with comments | « chrome/browser/chromeos/disks/disk_mount_manager.h ('k') | chrome/browser/chromeos/extensions/file_browser_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698