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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/drive/job_scheduler.cc
diff --git a/components/drive/job_scheduler.cc b/components/drive/job_scheduler.cc
index a6568d9aa934ce348aaeeae7842a4839eb11e9a4..e7fb5b6c7a8f222b4103095f96889d90c97c1846 100644
--- a/components/drive/job_scheduler.cc
+++ b/components/drive/job_scheduler.cc
@@ -721,9 +721,11 @@ void JobScheduler::AddPermission(
}
JobScheduler::JobEntry* JobScheduler::CreateNewJob(JobType type) {
- JobEntry* job = new JobEntry(type);
- job->job_info.job_id = job_map_.Add(job); // Takes the ownership of |job|.
- return job;
+ auto job = base::MakeUnique<JobEntry>(type);
+ JobEntry* job_raw = job.get();
+ int32_t job_key = job_map_.Add(std::move(job));
+ job_raw->job_info.job_id = job_key;
+ return job_raw;
}
void JobScheduler::StartJob(JobEntry* job) {
« 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