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

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

Issue 14634002: drive: Rename JobScheduler::QueueEntry to JobEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 7 years, 7 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/drive/job_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/job_scheduler.h
diff --git a/chrome/browser/chromeos/drive/job_scheduler.h b/chrome/browser/chromeos/drive/job_scheduler.h
index ea1ffd4a93e8023b0d5b69bac24834a6446f521d..2e5551959c75d9eba68b13ffc87f29836cb06e35 100644
--- a/chrome/browser/chromeos/drive/job_scheduler.h
+++ b/chrome/browser/chromeos/drive/job_scheduler.h
@@ -163,16 +163,16 @@ class JobScheduler
static const int kMaxJobCount[NUM_QUEUES];
- // Represents a single entry in the job queue.
- struct QueueEntry {
- QueueEntry();
- ~QueueEntry();
+ // Represents a single entry in the job map.
+ struct JobEntry {
+ explicit JobEntry(JobType type);
+ ~JobEntry();
- // Compare the two entries, per job priorities. Used for sorting entries
- // from high priority to low priority.
- static bool Compare(const QueueEntry* left, const QueueEntry* right);
+ // Returns true when |left| is in higher priority than |right|.
+ // Used for sorting entries from high priority to low priority.
+ static bool Less(const JobEntry& left, const JobEntry& right);
- JobID job_id;
+ JobInfo job_info;
// Context of the job.
DriveClientContext context;
@@ -294,10 +294,10 @@ class JobScheduler
// Adds the specified job to the queue and starts the job loop for the queue
// if needed. Returns the job ID for the new job.
- JobID StartNewJob(scoped_ptr<QueueEntry> job, JobType type);
+ JobID StartNewJob(scoped_ptr<JobEntry> job);
- // Adds the specified job to the queue. Takes ownership of |job|
- void QueueJob(scoped_ptr<QueueEntry> job);
+ // Adds the specified job to the queue.
+ void QueueJob(JobID job_id);
// Starts the job loop, if it is not already running.
void StartJobLoop(QueueType queue_type);
@@ -319,52 +319,60 @@ class JobScheduler
// Resets the throttle delay to the initial value, and continues the job loop.
void ResetThrottleAndContinueJobLoop(QueueType queue_type);
- // Retries the |queue_entry| job if needed and returns false.
- // Otherwise returns true.
- bool OnJobDone(scoped_ptr<QueueEntry> queue_entry, FileError error);
+ // Retries the job if needed and returns false. Otherwise returns true.
+ bool OnJobDone(JobID job_id, FileError error);
// Callback for job finishing with a GetResourceListCallback.
void OnGetResourceListJobDone(
- scoped_ptr<QueueEntry> queue_entry,
+ JobID job_id,
+ const google_apis::GetResourceListCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceList> resource_list);
// Callback for job finishing with a GetResourceEntryCallback.
void OnGetResourceEntryJobDone(
- scoped_ptr<QueueEntry> queue_entry,
+ JobID job_id,
+ const google_apis::GetResourceEntryCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ResourceEntry> entry);
// Callback for job finishing with a GetAboutResourceCallback.
void OnGetAboutResourceJobDone(
- scoped_ptr<QueueEntry> queue_entry,
+ JobID job_id,
+ const google_apis::GetAboutResourceCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::AboutResource> about_resource);
// Callback for job finishing with a GetAccountMetadataCallback.
void OnGetAccountMetadataJobDone(
- scoped_ptr<QueueEntry> queue_entry,
+ JobID job_id,
+ const google_apis::GetAccountMetadataCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::AccountMetadata> account_metadata);
// Callback for job finishing with a GetAppListCallback.
void OnGetAppListJobDone(
- scoped_ptr<QueueEntry> queue_entry,
+ JobID job_id,
+ const google_apis::GetAppListCallback& callback,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::AppList> app_list);
// Callback for job finishing with a EntryActionCallback.
- void OnEntryActionJobDone(scoped_ptr<QueueEntry> queue_entry,
+ void OnEntryActionJobDone(JobID job_id,
+ const google_apis::EntryActionCallback& callback,
google_apis::GDataErrorCode error);
// Callback for job finishing with a DownloadActionCallback.
- void OnDownloadActionJobDone(scoped_ptr<QueueEntry> queue_entry,
- google_apis::GDataErrorCode error,
- const base::FilePath& temp_file);
+ void OnDownloadActionJobDone(
+ JobID job_id,
+ const google_apis::DownloadActionCallback& callback,
+ google_apis::GDataErrorCode error,
+ const base::FilePath& temp_file);
// Callback for job finishing with a UploadCompletionCallback.
void OnUploadCompletionJobDone(
- scoped_ptr<QueueEntry> queue_entry,
+ JobID job_id,
+ const google_apis::UploadCompletionCallback& callback,
google_apis::GDataErrorCode error,
const base::FilePath& drive_path,
const base::FilePath& file_path,
@@ -406,10 +414,10 @@ class JobScheduler
bool disable_throttling_;
// The queues of jobs.
- std::list<QueueEntry*> queue_[NUM_QUEUES];
+ std::list<JobID> queue_[NUM_QUEUES];
// The list of unfinished (= queued or running) job info indexed by job IDs.
- typedef IDMap<JobInfo, IDMapOwnPointer> JobIDMap;
+ typedef IDMap<JobEntry, IDMapOwnPointer> JobIDMap;
JobIDMap job_map_;
// The list of observers for the scheduler.
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/job_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698