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