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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 scoped_ptr<const Value> DomainReliabilityContext::CreateReport( | 265 scoped_ptr<const Value> DomainReliabilityContext::CreateReport( |
266 base::TimeTicks upload_time) const { | 266 base::TimeTicks upload_time) const { |
267 ListValue* resources_value = new ListValue(); | 267 ListValue* resources_value = new ListValue(); |
268 for (ResourceStateIterator it = states_.begin(); it != states_.end(); ++it) { | 268 for (ResourceStateIterator it = states_.begin(); it != states_.end(); ++it) { |
269 scoped_ptr<Value> resource_report = (*it)->ToValue(upload_time); | 269 scoped_ptr<Value> resource_report = (*it)->ToValue(upload_time); |
270 if (resource_report) | 270 if (resource_report) |
271 resources_value->Append(resource_report.release()); | 271 resources_value->Append(resource_report.release()); |
272 } | 272 } |
273 | 273 |
274 DictionaryValue* report_value = new DictionaryValue(); | 274 DictionaryValue* report_value = new DictionaryValue(); |
| 275 report_value->SetString("config_version", config().version); |
275 report_value->SetString("reporter", upload_reporter_string_); | 276 report_value->SetString("reporter", upload_reporter_string_); |
276 report_value->Set("resource_reports", resources_value); | 277 report_value->Set("resource_reports", resources_value); |
277 | 278 |
278 return scoped_ptr<const Value>(report_value); | 279 return scoped_ptr<const Value>(report_value); |
279 } | 280 } |
280 | 281 |
281 void DomainReliabilityContext::MarkUpload() { | 282 void DomainReliabilityContext::MarkUpload() { |
282 for (ResourceStateIterator it = states_.begin(); it != states_.end(); ++it) | 283 for (ResourceStateIterator it = states_.begin(); it != states_.end(); ++it) |
283 (*it)->MarkUpload(); | 284 (*it)->MarkUpload(); |
284 uploading_beacon_count_ = beacon_count_; | 285 uploading_beacon_count_ = beacon_count_; |
(...skipping 26 matching lines...) Expand all Loading... |
311 | 312 |
312 min_resource->RemoveOldestBeacon(); | 313 min_resource->RemoveOldestBeacon(); |
313 --beacon_count_; | 314 --beacon_count_; |
314 // If that just removed a beacon counted in uploading_beacon_count_, decrement | 315 // If that just removed a beacon counted in uploading_beacon_count_, decrement |
315 // that. | 316 // that. |
316 if (uploading_beacon_count_ > 0) | 317 if (uploading_beacon_count_ > 0) |
317 --uploading_beacon_count_; | 318 --uploading_beacon_count_; |
318 } | 319 } |
319 | 320 |
320 } // namespace domain_reliability | 321 } // namespace domain_reliability |
OLD | NEW |