| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void CrashReportUploadThread::ProcessPendingReport( | 224 void CrashReportUploadThread::ProcessPendingReport( |
| 225 const CrashReportDatabase::Report& report) { | 225 const CrashReportDatabase::Report& report) { |
| 226 Settings* const settings = database_->GetSettings(); | 226 Settings* const settings = database_->GetSettings(); |
| 227 | 227 |
| 228 bool uploads_enabled; | 228 bool uploads_enabled; |
| 229 if (!settings->GetUploadsEnabled(&uploads_enabled) || !uploads_enabled) { | 229 if (!settings->GetUploadsEnabled(&uploads_enabled) || |
| 230 // If uploads are disabled or the upload-enabled state can’t be determined, | 230 !uploads_enabled || |
| 231 // don’t attempt to upload the new report. | 231 url_.empty()) { |
| 232 // If the upload-enabled state can’t be determined, uploads are disabled, or |
| 233 // there’s no URL to upload to, don’t attempt to upload the new report. |
| 232 database_->SkipReportUpload(report.uuid); | 234 database_->SkipReportUpload(report.uuid); |
| 233 return; | 235 return; |
| 234 } | 236 } |
| 235 | 237 |
| 236 // This currently implements very simplistic rate-limiting, compatible with | 238 // This currently implements very simplistic rate-limiting, compatible with |
| 237 // the Breakpad client, where the strategy is to permit one upload attempt per | 239 // the Breakpad client, where the strategy is to permit one upload attempt per |
| 238 // hour, and retire reports that would exceed this limit or for which the | 240 // hour, and retire reports that would exceed this limit or for which the |
| 239 // upload fails on the first attempt. | 241 // upload fails on the first attempt. |
| 240 // | 242 // |
| 241 // TODO(mark): Provide a proper rate-limiting strategy and allow for failed | 243 // TODO(mark): Provide a proper rate-limiting strategy and allow for failed |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 362 } |
| 361 | 363 |
| 362 // static | 364 // static |
| 363 void* CrashReportUploadThread::RunThreadMain(void* arg) { | 365 void* CrashReportUploadThread::RunThreadMain(void* arg) { |
| 364 CrashReportUploadThread* self = static_cast<CrashReportUploadThread*>(arg); | 366 CrashReportUploadThread* self = static_cast<CrashReportUploadThread*>(arg); |
| 365 self->ThreadMain(); | 367 self->ThreadMain(); |
| 366 return nullptr; | 368 return nullptr; |
| 367 } | 369 } |
| 368 | 370 |
| 369 } // namespace crashpad | 371 } // namespace crashpad |
| OLD | NEW |