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

Side by Side Diff: chrome/service/cloud_print/printer_job_queue_handler.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix various builds. Created 4 years, 7 months 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) 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/service/cloud_print/printer_job_queue_handler.h" 5 #include "chrome/service/cloud_print/printer_job_queue_handler.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 std::vector<JobDetails> PrinterJobQueueHandler::GetJobsFromQueue( 112 std::vector<JobDetails> PrinterJobQueueHandler::GetJobsFromQueue(
113 const base::DictionaryValue& json_data) { 113 const base::DictionaryValue& json_data) {
114 std::vector<JobDetails> jobs; 114 std::vector<JobDetails> jobs;
115 115
116 const base::ListValue* job_list = nullptr; 116 const base::ListValue* job_list = nullptr;
117 if (!json_data.GetList(kJobListValue, &job_list)) 117 if (!json_data.GetList(kJobListValue, &job_list))
118 return jobs; 118 return jobs;
119 119
120 std::vector<JobDetails> jobs_with_timeouts; 120 std::vector<JobDetails> jobs_with_timeouts;
121 for (const auto* job_value : *job_list) { 121 for (const auto& job_value : *job_list) {
122 const base::DictionaryValue* job_data = nullptr; 122 const base::DictionaryValue* job_data = nullptr;
123 if (!job_value->GetAsDictionary(&job_data)) 123 if (!job_value->GetAsDictionary(&job_data))
124 continue; 124 continue;
125 125
126 JobDetails job_details_current = ConstructJobDetailsFromJson(*job_data); 126 JobDetails job_details_current = ConstructJobDetailsFromJson(*job_data);
127 job_details_current.time_remaining_ = 127 job_details_current.time_remaining_ =
128 ComputeBackoffTime(job_details_current.job_id_); 128 ComputeBackoffTime(job_details_current.job_id_);
129 if (job_details_current.time_remaining_.is_zero()) { 129 if (job_details_current.time_remaining_.is_zero()) {
130 jobs.push_back(job_details_current); 130 jobs.push_back(job_details_current);
131 } else { 131 } else {
(...skipping 29 matching lines...) Expand all
161 } 161 }
162 162
163 job_found.first->second.retries_ += 1; 163 job_found.first->second.retries_ += 1;
164 job_found.first->second.last_retry_ = time_provider_->GetNow(); 164 job_found.first->second.last_retry_ = time_provider_->GetNow();
165 } 165 }
166 166
167 return true; 167 return true;
168 } 168 }
169 169
170 } // namespace cloud_print 170 } // namespace cloud_print
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698