| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 base::TimeTicks first_beacon_time = scheduler_.first_beacon_time(); | 253 base::TimeTicks first_beacon_time = scheduler_.first_beacon_time(); |
| 254 scheduler_.OnUploadComplete(result); | 254 scheduler_.OnUploadComplete(result); |
| 255 UMA_HISTOGRAM_BOOLEAN("DomainReliability.UploadSuccess", | 255 UMA_HISTOGRAM_BOOLEAN("DomainReliability.UploadSuccess", |
| 256 result.is_success()); | 256 result.is_success()); |
| 257 base::TimeTicks now = time_->NowTicks(); | 257 base::TimeTicks now = time_->NowTicks(); |
| 258 UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadLatency", | 258 UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadLatency", |
| 259 now - first_beacon_time); | 259 now - first_beacon_time); |
| 260 DCHECK(!upload_time_.is_null()); | 260 DCHECK(!upload_time_.is_null()); |
| 261 UMA_HISTOGRAM_MEDIUM_TIMES("DomainReliability.UploadDuration", | 261 UMA_HISTOGRAM_MEDIUM_TIMES("DomainReliability.UploadDuration", |
| 262 now - upload_time_); | 262 now - upload_time_); |
| 263 UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadCollectorRetryDelay", |
| 264 scheduler_.last_collector_retry_delay()); |
| 263 last_upload_time_ = upload_time_; | 265 last_upload_time_ = upload_time_; |
| 264 upload_time_ = base::TimeTicks(); | 266 upload_time_ = base::TimeTicks(); |
| 265 } | 267 } |
| 266 | 268 |
| 267 scoped_ptr<const Value> DomainReliabilityContext::CreateReport( | 269 scoped_ptr<const Value> DomainReliabilityContext::CreateReport( |
| 268 base::TimeTicks upload_time) const { | 270 base::TimeTicks upload_time) const { |
| 269 scoped_ptr<ListValue> beacons_value(new ListValue()); | 271 scoped_ptr<ListValue> beacons_value(new ListValue()); |
| 270 for (BeaconConstIterator it = beacons_.begin(); it != beacons_.end(); ++it) | 272 for (BeaconConstIterator it = beacons_.begin(); it != beacons_.end(); ++it) |
| 271 beacons_value->Append(it->ToValue(upload_time, *last_network_change_time_)); | 273 beacons_value->Append(it->ToValue(upload_time, *last_network_change_time_)); |
| 272 | 274 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 323 |
| 322 beacons_.pop_front(); | 324 beacons_.pop_front(); |
| 323 | 325 |
| 324 // If that just removed a beacon counted in uploading_beacons_size_, decrement | 326 // If that just removed a beacon counted in uploading_beacons_size_, decrement |
| 325 // that. | 327 // that. |
| 326 if (uploading_beacons_size_ > 0) | 328 if (uploading_beacons_size_ > 0) |
| 327 --uploading_beacons_size_; | 329 --uploading_beacons_size_; |
| 328 } | 330 } |
| 329 | 331 |
| 330 } // namespace domain_reliability | 332 } // namespace domain_reliability |
| OLD | NEW |