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..0671105498eaea9dc49a92a461c3b85c9142fc65 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); |
+ const QueueType queue_type = GetJobQueueType(job->job_info.job_type); |
+ job->job_info.num_total_jobs = queue_[queue_type]->GetNumberOfJobs(); |
NotifyJobAdded(job->job_info); |
DoJobLoop(GetJobQueueType(job->job_info.job_type)); |
} |
@@ -715,7 +717,7 @@ void JobScheduler::QueueJob(JobID job_id) { |
DCHECK(job_entry); |
const JobInfo& job_info = job_entry->job_info; |
- QueueType queue_type = GetJobQueueType(job_info.job_type); |
+ const QueueType queue_type = GetJobQueueType(job_info.job_type); |
queue_[queue_type]->Push(job_id, job_entry->context.type); |
const std::string retry_prefix = job_entry->retry_count > 0 ? |
@@ -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; |
+ const 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 +865,8 @@ bool JobScheduler::OnJobDone(JobID job_id, google_apis::GDataErrorCode error) { |
// Requeue the job. |
QueueJob(job_id); |
} else { |
+ const 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 +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; |
+ const 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 +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, |