| Index: chrome/browser/chromeos/drive/job_scheduler.cc
|
| diff --git a/chrome/browser/chromeos/drive/job_scheduler.cc b/chrome/browser/chromeos/drive/job_scheduler.cc
|
| index 3242e6e3de15583befd64bc2e95aac655f876976..4de6477e9d931dc9a6c789f93e256d21c1306734 100644
|
| --- a/chrome/browser/chromeos/drive/job_scheduler.cc
|
| +++ b/chrome/browser/chromeos/drive/job_scheduler.cc
|
| @@ -169,23 +169,21 @@ void JobScheduler::RemoveObserver(JobListObserver* observer) {
|
| void JobScheduler::CancelJob(JobID job_id) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| - // TODO(kinaba): Completely remove drive_service_->CancelForFilePath
|
| - // once DriveUploader supported cancellation callback: crbug.com/257012.
|
| JobEntry* job = job_map_.Lookup(job_id);
|
| if (job) {
|
| + // TODO(kinaba): crbug.com/251116 Support cancelling jobs not yet started.
|
| if (!job->cancel_callback.is_null())
|
| job->cancel_callback.Run();
|
| - else
|
| - drive_service_->CancelForFilePath(job->job_info.file_path);
|
| }
|
| }
|
|
|
| void JobScheduler::CancelAllJobs() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| - // TODO(kinaba): Move the cancellation feature from DriveService
|
| - // to JobScheduler.
|
| - drive_service_->CancelAll();
|
| + // CancelJob may remove the entry from |job_map_|. That's OK. IDMap supports
|
| + // removable during iteration.
|
| + for (JobIDMap::iterator iter(&job_map_); !iter.IsAtEnd(); iter.Advance())
|
| + CancelJob(iter.GetCurrentKey());
|
| }
|
|
|
| void JobScheduler::GetAboutResource(
|
|
|