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/rappor/log_uploader.h" | 5 #include "components/rappor/log_uploader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 base::TimeDelta max_interval = | 136 base::TimeDelta max_interval = |
137 base::TimeDelta::FromSeconds(kMaxBackoffIntervalSeconds); | 137 base::TimeDelta::FromSeconds(kMaxBackoffIntervalSeconds); |
138 return interval > max_interval ? max_interval : interval; | 138 return interval > max_interval ? max_interval : interval; |
139 } | 139 } |
140 | 140 |
141 void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) { | 141 void LogUploader::OnURLFetchComplete(const net::URLFetcher* source) { |
142 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. | 142 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. |
143 // Note however that |source| is aliased to the fetcher, so we should be | 143 // Note however that |source| is aliased to the fetcher, so we should be |
144 // careful not to delete it too early. | 144 // careful not to delete it too early. |
145 DCHECK_EQ(current_fetch_.get(), source); | 145 DCHECK_EQ(current_fetch_.get(), source); |
146 scoped_ptr<net::URLFetcher> fetch(std::move(current_fetch_)); | 146 std::unique_ptr<net::URLFetcher> fetch(std::move(current_fetch_)); |
147 | 147 |
148 const net::URLRequestStatus& request_status = source->GetStatus(); | 148 const net::URLRequestStatus& request_status = source->GetStatus(); |
149 | 149 |
150 const int response_code = source->GetResponseCode(); | 150 const int response_code = source->GetResponseCode(); |
151 DVLOG(2) << "Upload fetch complete response code: " << response_code; | 151 DVLOG(2) << "Upload fetch complete response code: " << response_code; |
152 | 152 |
153 if (request_status.status() != net::URLRequestStatus::SUCCESS) { | 153 if (request_status.status() != net::URLRequestStatus::SUCCESS) { |
154 UMA_HISTOGRAM_SPARSE_SLOWLY("Rappor.FailedUploadErrorCode", | 154 UMA_HISTOGRAM_SPARSE_SLOWLY("Rappor.FailedUploadErrorCode", |
155 -request_status.error()); | 155 -request_status.error()); |
156 DVLOG(1) << "Rappor server upload failed with error: " | 156 DVLOG(1) << "Rappor server upload failed with error: " |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (!server_is_healthy) | 193 if (!server_is_healthy) |
194 upload_interval_ = BackOffUploadInterval(upload_interval_); | 194 upload_interval_ = BackOffUploadInterval(upload_interval_); |
195 else | 195 else |
196 upload_interval_ = base::TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds); | 196 upload_interval_ = base::TimeDelta::FromSeconds(kUnsentLogsIntervalSeconds); |
197 | 197 |
198 if (CanStartUpload()) | 198 if (CanStartUpload()) |
199 ScheduleNextUpload(upload_interval_); | 199 ScheduleNextUpload(upload_interval_); |
200 } | 200 } |
201 | 201 |
202 } // namespace rappor | 202 } // namespace rappor |
OLD | NEW |