| 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..fa175b1db4cbe57bc0e3207a12d93ab1baec8c03 100644
|
| --- a/chrome/browser/chromeos/drive/job_scheduler.cc
|
| +++ b/chrome/browser/chromeos/drive/job_scheduler.cc
|
| @@ -704,6 +704,11 @@ 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);
|
| + job->job_info.num_total_jobs = queue_[queue_type]->GetNumberOfJobs();
|
| + if (queue_type == FILE_QUEUE) {
|
| + job->job_info.state = STATE_NEW;
|
| + }
|
| NotifyJobAdded(job->job_info);
|
| DoJobLoop(GetJobQueueType(job->job_info.job_type));
|
| }
|
| @@ -766,6 +771,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 +859,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);
|
| + job_info->num_total_jobs = queue_[queue_type]->GetNumberOfJobs();
|
| NotifyJobUpdated(*job_info);
|
|
|
| ++job_entry->retry_count;
|
| @@ -860,6 +868,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);
|
| + 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 +1047,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);
|
| + job_entry->job_info.num_total_jobs = queue_[queue_type]->GetNumberOfJobs();
|
| NotifyJobUpdated(job_entry->job_info);
|
| }
|
|
|
| @@ -1098,6 +1110,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,
|
|
|