| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 std::unique_ptr<base::DictionaryValue> last(new base::DictionaryValue()); | 177 std::unique_ptr<base::DictionaryValue> last(new base::DictionaryValue()); |
| 178 last->SetInteger("start_time", (now - last_upload_start_time_).InSeconds()); | 178 last->SetInteger("start_time", (now - last_upload_start_time_).InSeconds()); |
| 179 last->SetInteger("end_time", (now - last_upload_end_time_).InSeconds()); | 179 last->SetInteger("end_time", (now - last_upload_end_time_).InSeconds()); |
| 180 last->SetInteger("collector_index", | 180 last->SetInteger("collector_index", |
| 181 static_cast<int>(last_upload_collector_index_)); | 181 static_cast<int>(last_upload_collector_index_)); |
| 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 (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(std::move(value)); | 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); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |