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

Unified Diff: chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h

Issue 2348813002: Fix a bug that unmounting devices on the policy update can be a busy loop. (Closed)
Patch Set: Format fix, use reference where copy isn't needed. Created 4 years, 3 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 | « no previous file | chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h
diff --git a/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h b/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h
index 14e3a887b3021c00bf85c55120d4214137780584..cef406d775920aa84679dc8e5f0fdfc6965180d9 100644
--- a/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h
+++ b/chrome/browser/chromeos/file_manager/fake_disk_mount_manager.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
#define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FAKE_DISK_MOUNT_MANAGER_H_
+#include <queue>
#include <string>
#include <vector>
@@ -51,6 +52,11 @@ class FakeDiskMountManager : public chromeos::disks::DiskMountManager {
return unmount_requests_;
}
+ // Emulates that all mount request finished.
+ // Return true if there was one or more mount request enqueued, or false
+ // otherwise.
+ bool FinishAllUnmountPathRequests();
+
// DiskMountManager overrides.
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
@@ -66,6 +72,9 @@ class FakeDiskMountManager : public chromeos::disks::DiskMountManager {
const std::string& mount_label,
chromeos::MountType type,
chromeos::MountAccessMode access_mode) override;
+ // In order to simulate asynchronous invocation of callbacks after unmount
+ // is finished, |callback| will be invoked only when
+ // |FinishAllUnmountRequest()| is called.
void UnmountPath(const std::string& mount_path,
chromeos::UnmountOptions options,
const UnmountPathCallback& callback) override;
@@ -80,6 +89,7 @@ class FakeDiskMountManager : public chromeos::disks::DiskMountManager {
private:
base::ObserverList<Observer> observers_;
+ std::queue<UnmountPathCallback> pending_unmount_callbacks_;
Lei Zhang 2016/09/27 17:21:02 With this, we can no longer depend on base/callbac
DiskMap disks_;
MountPointMap mount_points_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_manager/fake_disk_mount_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698