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

Side by Side Diff: components/drive/job_scheduler.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Make changes requested by danakj, fix a few more headers Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/drive/job_scheduler.h" 5 #include "components/drive/job_scheduler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 role, 714 role,
715 base::Bind(&JobScheduler::OnEntryActionJobDone, 715 base::Bind(&JobScheduler::OnEntryActionJobDone,
716 weak_ptr_factory_.GetWeakPtr(), 716 weak_ptr_factory_.GetWeakPtr(),
717 new_job->job_info.job_id, 717 new_job->job_info.job_id,
718 callback)); 718 callback));
719 new_job->abort_callback = callback; 719 new_job->abort_callback = callback;
720 StartJob(new_job); 720 StartJob(new_job);
721 } 721 }
722 722
723 JobScheduler::JobEntry* JobScheduler::CreateNewJob(JobType type) { 723 JobScheduler::JobEntry* JobScheduler::CreateNewJob(JobType type) {
724 JobEntry* job = new JobEntry(type); 724 auto job = base::MakeUnique<JobEntry>(type);
725 job->job_info.job_id = job_map_.Add(job); // Takes the ownership of |job|. 725 JobEntry* job_raw = job.get();
726 return job; 726 int32_t job_key = job_map_.Add(std::move(job));
727 job_raw->job_info.job_id = job_key;
728 return job_raw;
727 } 729 }
728 730
729 void JobScheduler::StartJob(JobEntry* job) { 731 void JobScheduler::StartJob(JobEntry* job) {
730 DCHECK(!job->task.is_null()); 732 DCHECK(!job->task.is_null());
731 733
732 QueueJob(job->job_info.job_id); 734 QueueJob(job->job_info.job_id);
733 NotifyJobAdded(job->job_info); 735 NotifyJobAdded(job->job_info);
734 DoJobLoop(GetJobQueueType(job->job_info.job_type)); 736 DoJobLoop(GetJobQueueType(job->job_info.job_type));
735 } 737 }
736 738
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 case FILE_QUEUE: 1191 case FILE_QUEUE:
1190 return "FILE_QUEUE"; 1192 return "FILE_QUEUE";
1191 case NUM_QUEUES: 1193 case NUM_QUEUES:
1192 break; // This value is just a sentinel. Should never be used. 1194 break; // This value is just a sentinel. Should never be used.
1193 } 1195 }
1194 NOTREACHED(); 1196 NOTREACHED();
1195 return ""; 1197 return "";
1196 } 1198 }
1197 1199
1198 } // namespace drive 1200 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/core_tab_helper.cc ('k') | components/gcm_driver/instance_id/instance_id_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698