| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 size_t collector_index = scheduler_.OnUploadStart(); | 228 size_t collector_index = scheduler_.OnUploadStart(); |
| 229 | 229 |
| 230 uploader_->UploadReport( | 230 uploader_->UploadReport( |
| 231 report_json, | 231 report_json, |
| 232 config_->collectors[collector_index]->upload_url, | 232 config_->collectors[collector_index]->upload_url, |
| 233 base::Bind( | 233 base::Bind( |
| 234 &DomainReliabilityContext::OnUploadComplete, | 234 &DomainReliabilityContext::OnUploadComplete, |
| 235 weak_factory_.GetWeakPtr())); | 235 weak_factory_.GetWeakPtr())); |
| 236 | 236 |
| 237 UMA_HISTOGRAM_BOOLEAN("DomainReliability.UploadFailover", | 237 UMA_HISTOGRAM_SPARSE_SLOWLY("DomainReliability.UploadCollectorIndex", |
| 238 collector_index > 0); | 238 static_cast<int>(collector_index)); |
| 239 if (!last_upload_time_.is_null()) { | 239 if (!last_upload_time_.is_null()) { |
| 240 UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadInterval", | 240 UMA_HISTOGRAM_LONG_TIMES("DomainReliability.UploadInterval", |
| 241 upload_time_ - last_upload_time_); | 241 upload_time_ - last_upload_time_); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 void DomainReliabilityContext::OnUploadComplete(bool success) { | 245 void DomainReliabilityContext::OnUploadComplete(bool success) { |
| 246 if (success) | 246 if (success) |
| 247 CommitUpload(); | 247 CommitUpload(); |
| 248 else | 248 else |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 beacons_.pop_front(); | 314 beacons_.pop_front(); |
| 315 | 315 |
| 316 // If that just removed a beacon counted in uploading_beacons_size_, decrement | 316 // If that just removed a beacon counted in uploading_beacons_size_, decrement |
| 317 // that. | 317 // that. |
| 318 if (uploading_beacons_size_ > 0) | 318 if (uploading_beacons_size_ > 0) |
| 319 --uploading_beacons_size_; | 319 --uploading_beacons_size_; |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace domain_reliability | 322 } // namespace domain_reliability |
| OLD | NEW |