OLD | NEW |
---|---|
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 last->SetBoolean("success", last_upload_success_); | 182 last->SetBoolean("success", last_upload_success_); |
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. | |
danakj
2016/08/26 22:59:24
:D
| |
193 collectors_value->Append(std::move(value)); | 192 collectors_value->Append(std::move(value)); |
194 } | 193 } |
195 data->Set("collectors", std::move(collectors_value)); | 194 data->Set("collectors", std::move(collectors_value)); |
196 | 195 |
197 return std::move(data); | 196 return std::move(data); |
198 } | 197 } |
199 | 198 |
200 void DomainReliabilityScheduler::MakeDeterministicForTesting() { | 199 void DomainReliabilityScheduler::MakeDeterministicForTesting() { |
201 backoff_policy_.jitter_factor = 0.0; | 200 backoff_policy_.jitter_factor = 0.0; |
202 } | 201 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 min_index = i; | 260 min_index = i; |
262 } | 261 } |
263 } | 262 } |
264 | 263 |
265 DCHECK_NE(kInvalidCollectorIndex, min_index); | 264 DCHECK_NE(kInvalidCollectorIndex, min_index); |
266 *upload_time_out = min_time; | 265 *upload_time_out = min_time; |
267 *collector_index_out = min_index; | 266 *collector_index_out = min_index; |
268 } | 267 } |
269 | 268 |
270 } // namespace domain_reliability | 269 } // namespace domain_reliability |
OLD | NEW |