Chromium Code Reviews| 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 13aa7df2d4e9296ca1b1eea5045157cb2d0245cb..0c5d1b929c6a001e9bc652b534808a87e2680d0f 100644 |
| --- a/chrome/browser/chromeos/drive/job_scheduler.cc |
| +++ b/chrome/browser/chromeos/drive/job_scheduler.cc |
| @@ -704,6 +704,8 @@ void JobScheduler::StartJob(JobEntry* job) { |
| DCHECK(!job->task.is_null()); |
| QueueJob(job->job_info.job_id); |
| + QueueType queue_type = GetJobQueueType(job->job_info.job_type); |
|
hirono
2014/08/29 11:50:46
const
iseki
2014/09/01 02:24:46
Done.
|
| + job->job_info.num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
| NotifyJobAdded(job->job_info); |
| DoJobLoop(GetJobQueueType(job->job_info.job_type)); |
| } |
| @@ -766,6 +768,7 @@ void JobScheduler::DoJobLoop(QueueType queue_type) { |
| JobInfo* job_info = &entry->job_info; |
| job_info->state = STATE_RUNNING; |
| job_info->start_time = now; |
| + job_info->num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
| NotifyJobUpdated(*job_info); |
| entry->cancel_callback = entry->task.Run(); |
| @@ -853,6 +856,8 @@ bool JobScheduler::OnJobDone(JobID job_id, google_apis::GDataErrorCode error) { |
| if (should_retry) { |
| job_entry->cancel_callback.Reset(); |
| job_info->state = STATE_RETRY; |
| + QueueType queue_type = GetJobQueueType(job_info->job_type); |
|
hirono
2014/08/29 11:50:46
const
iseki
2014/09/01 02:24:46
Done.
|
| + job_info->num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
| NotifyJobUpdated(*job_info); |
| ++job_entry->retry_count; |
| @@ -860,6 +865,8 @@ bool JobScheduler::OnJobDone(JobID job_id, google_apis::GDataErrorCode error) { |
| // Requeue the job. |
| QueueJob(job_id); |
| } else { |
| + QueueType queue_type = GetJobQueueType(job_info->job_type); |
|
hirono
2014/08/29 11:50:46
const
iseki
2014/09/01 02:24:46
Done.
|
| + job_info->num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
| NotifyJobDone(*job_info, error); |
| // The job has finished, no retry will happen in the scheduler. Now we can |
| // remove the job info from the map. |
| @@ -1037,6 +1044,8 @@ void JobScheduler::UpdateProgress(JobID job_id, int64 progress, int64 total) { |
| job_entry->job_info.num_completed_bytes = progress; |
| if (total != -1) |
| job_entry->job_info.num_total_bytes = total; |
| + QueueType queue_type = GetJobQueueType(job_entry->job_info.job_type); |
|
hirono
2014/08/29 11:50:46
const
iseki
2014/09/01 02:24:46
Done.
|
| + job_entry->job_info.num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
| NotifyJobUpdated(job_entry->job_info); |
| } |
| @@ -1098,6 +1107,7 @@ void JobScheduler::AbortNotRunningJob(JobEntry* job, |
| base::Callback<void(google_apis::GDataErrorCode)> callback = |
| job->abort_callback; |
| queue_[GetJobQueueType(job->job_info.job_type)]->Remove(job->job_info.job_id); |
| + job->job_info.num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
| NotifyJobDone(job->job_info, error); |
| job_map_.Remove(job->job_info.job_id); |
| base::MessageLoopProxy::current()->PostTask(FROM_HERE, |