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

Unified Diff: chrome/browser/chromeos/drive/drive_scheduler.h

Issue 11142036: Add Move operation to the the scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
Index: chrome/browser/chromeos/drive/drive_scheduler.h
diff --git a/chrome/browser/chromeos/drive/drive_scheduler.h b/chrome/browser/chromeos/drive/drive_scheduler.h
index 8359f770b76dda871c3db7f48b3878d8bfde1611..3bedacdcc2f68336b80ef87e4255de84b2d84678 100644
--- a/chrome/browser/chromeos/drive/drive_scheduler.h
+++ b/chrome/browser/chromeos/drive/drive_scheduler.h
@@ -32,6 +32,7 @@ class DriveScheduler
// Enum representing the type of job.
enum JobType {
+ TYPE_MOVE,
TYPE_REMOVE,
};
@@ -78,6 +79,11 @@ class DriveScheduler
// other functions.
void Initialize();
+ // Adds a move operation to the queue.
+ void Move(const FilePath& src_file_path,
+ const FilePath& dest_file_path,
+ const FileOperationCallback& callback);
+
// Adds a remove operation to the queue.
void Remove(const FilePath& file_path,
bool is_recursive,
@@ -86,23 +92,24 @@ class DriveScheduler
private:
friend class DriveSchedulerTest;
- // Data specific to a remove operation.
- struct RemoveJobPrivate {
- RemoveJobPrivate(bool in_is_recursive, FileOperationCallback in_callback);
- ~RemoveJobPrivate();
-
- bool is_recursive;
- FileOperationCallback callback;
- };
-
// Represents a single entry in the job queue.
struct QueueEntry {
- QueueEntry(JobType in_job_type, FilePath in_file_path);
+ QueueEntry(JobType in_job_type,
+ FilePath in_file_path,
+ FileOperationCallback in_callback);
~QueueEntry();
JobInfo job_info;
- scoped_ptr<RemoveJobPrivate> remove_private;
+ // Callback for when the operation completes.
+ // Used by: TYPE_MOVE, TYPE_REMOVE
+ FileOperationCallback callback;
+
+ // Destination of the operation. Used by: TYPE_MOVE
+ FilePath dest_file_path;
+
+ // Whether the operation is recursive. Used by: TYPE_REMOVE
+ bool is_recursive;
};
// Adds the specified job to the queue. Takes ownership of |job|
@@ -127,10 +134,9 @@ class DriveScheduler
// Resets the throttle delay to the initial value, and continues the job loop.
void ResetThrottleAndContinueJobLoop();
- // Callback for job of TYPE_REMOVE finishing. Retries the job if needed,
- // otherwise cleans up the job, invokes the callback, and continues the job
- // loop.
- void OnRemoveDone(int job_id, DriveFileError error);
+ // Callback for job finishing. Retries the job if needed, otherwise cleans up
+ // the job, invokes the callback, and continues the job loop.
+ void OnJobDone(int job_id, DriveFileError error);
// net::NetworkChangeNotifier::ConnectionTypeObserver override.
virtual void OnConnectionTypeChanged(

Powered by Google App Engine
This is Rietveld 408576698