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

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

Issue 17385023: Get rid of RequestRegistry (part 2): remove cancellation methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused methods in RequestRegisty Created 7 years, 6 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/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(
« no previous file with comments | « chrome/browser/chromeos/contacts/gdata_contacts_service.cc ('k') | chrome/browser/drive/drive_api_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698