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/context.h" | 5 #include "components/domain_reliability/context.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 upload_time_ = base::TimeTicks(); | 197 upload_time_ = base::TimeTicks(); |
198 } | 198 } |
199 | 199 |
200 std::unique_ptr<const Value> DomainReliabilityContext::CreateReport( | 200 std::unique_ptr<const Value> DomainReliabilityContext::CreateReport( |
201 base::TimeTicks upload_time, | 201 base::TimeTicks upload_time, |
202 const GURL& collector_url, | 202 const GURL& collector_url, |
203 int* max_upload_depth_out) const { | 203 int* max_upload_depth_out) const { |
204 int max_upload_depth = 0; | 204 int max_upload_depth = 0; |
205 | 205 |
206 std::unique_ptr<ListValue> beacons_value(new ListValue()); | 206 std::unique_ptr<ListValue> beacons_value(new ListValue()); |
207 for (const auto& beacon : beacons_) { | 207 for (const auto* beacon : beacons_) { |
208 beacons_value->Append(beacon->ToValue(upload_time, | 208 beacons_value->Append(beacon->ToValue(upload_time, |
209 *last_network_change_time_, | 209 *last_network_change_time_, |
210 collector_url, | 210 collector_url, |
211 config().path_prefixes)); | 211 config().path_prefixes)); |
212 if (beacon->upload_depth > max_upload_depth) | 212 if (beacon->upload_depth > max_upload_depth) |
213 max_upload_depth = beacon->upload_depth; | 213 max_upload_depth = beacon->upload_depth; |
214 } | 214 } |
215 | 215 |
216 std::unique_ptr<DictionaryValue> report_value(new DictionaryValue()); | 216 std::unique_ptr<DictionaryValue> report_value(new DictionaryValue()); |
217 report_value->SetString("reporter", upload_reporter_string_); | 217 report_value->SetString("reporter", upload_reporter_string_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 delete beacons_.front(); | 250 delete beacons_.front(); |
251 beacons_.pop_front(); | 251 beacons_.pop_front(); |
252 | 252 |
253 // If that just removed a beacon counted in uploading_beacons_size_, decrement | 253 // If that just removed a beacon counted in uploading_beacons_size_, decrement |
254 // that. | 254 // that. |
255 if (uploading_beacons_size_ > 0) | 255 if (uploading_beacons_size_ > 0) |
256 --uploading_beacons_size_; | 256 --uploading_beacons_size_; |
257 } | 257 } |
258 | 258 |
259 } // namespace domain_reliability | 259 } // namespace domain_reliability |
OLD | NEW |