OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/policy/cloud/external_policy_data_updater.h" | 5 #include "chrome/browser/policy/cloud/external_policy_data_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 delete job->second; | 379 delete job->second; |
380 job_map_.erase(job); | 380 job_map_.erase(job); |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 void ExternalPolicyDataUpdater::StartNextJobs() { | 384 void ExternalPolicyDataUpdater::StartNextJobs() { |
385 if (shutting_down_) | 385 if (shutting_down_) |
386 return; | 386 return; |
387 | 387 |
388 while (running_jobs_ < max_parallel_jobs_ && !job_queue_.empty()) { | 388 while (running_jobs_ < max_parallel_jobs_ && !job_queue_.empty()) { |
389 FetchJob* job = job_queue_.front(); | 389 FetchJob* job = job_queue_.front().get(); |
390 job_queue_.pop(); | 390 job_queue_.pop(); |
391 | 391 |
392 // Some of the jobs may have been invalidated, and have to be skipped. | 392 // Some of the jobs may have been invalidated, and have to be skipped. |
393 if (job) { | 393 if (job) { |
394 ++running_jobs_; | 394 ++running_jobs_; |
395 // A started job will always call OnJobSucceeded() or OnJobFailed(). | 395 // A started job will always call OnJobSucceeded() or OnJobFailed(). |
396 job->Start(); | 396 job->Start(); |
397 } | 397 } |
398 } | 398 } |
399 } | 399 } |
(...skipping 22 matching lines...) Expand all Loading... |
422 DCHECK_EQ(job_map_[job->key()], job); | 422 DCHECK_EQ(job_map_[job->key()], job); |
423 | 423 |
424 --running_jobs_; | 424 --running_jobs_; |
425 | 425 |
426 // The job is not deleted when it fails because a retry attempt may have been | 426 // The job is not deleted when it fails because a retry attempt may have been |
427 // scheduled. | 427 // scheduled. |
428 StartNextJobs(); | 428 StartNextJobs(); |
429 } | 429 } |
430 | 430 |
431 } // namespace policy | 431 } // namespace policy |
OLD | NEW |