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

Side by Side Diff: components/domain_reliability/scheduler.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/domain_reliability/scheduler.h" 5 #include "components/domain_reliability/scheduler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 data->Set("last_upload", std::move(last)); 183 data->Set("last_upload", std::move(last));
184 } 184 }
185 185
186 std::unique_ptr<base::ListValue> collectors_value(new base::ListValue()); 186 std::unique_ptr<base::ListValue> collectors_value(new base::ListValue());
187 for (const auto& collector : collectors_) { 187 for (const auto& collector : collectors_) {
188 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 188 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
189 value->SetInteger("failures", collector->failure_count()); 189 value->SetInteger("failures", collector->failure_count());
190 value->SetInteger("next_upload", 190 value->SetInteger("next_upload",
191 (collector->GetReleaseTime() - now).InSeconds()); 191 (collector->GetReleaseTime() - now).InSeconds());
192 // Using release instead of Pass because Pass can't implicitly upcast. 192 // Using release instead of Pass because Pass can't implicitly upcast.
193 collectors_value->Append(value.release()); 193 collectors_value->Append(std::move(value));
194 } 194 }
195 data->Set("collectors", std::move(collectors_value)); 195 data->Set("collectors", std::move(collectors_value));
196 196
197 return std::move(data); 197 return std::move(data);
198 } 198 }
199 199
200 void DomainReliabilityScheduler::MakeDeterministicForTesting() { 200 void DomainReliabilityScheduler::MakeDeterministicForTesting() {
201 backoff_policy_.jitter_factor = 0.0; 201 backoff_policy_.jitter_factor = 0.0;
202 } 202 }
203 203
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 min_index = i; 261 min_index = i;
262 } 262 }
263 } 263 }
264 264
265 DCHECK_NE(kInvalidCollectorIndex, min_index); 265 DCHECK_NE(kInvalidCollectorIndex, min_index);
266 *upload_time_out = min_time; 266 *upload_time_out = min_time;
267 *collector_index_out = min_index; 267 *collector_index_out = min_index;
268 } 268 }
269 269
270 } // namespace domain_reliability 270 } // namespace domain_reliability
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698