Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: third_party/crashpad/crashpad/handler/crash_report_upload_thread.cc

Issue 2277943002: Update Crashpad to b35ee1fca18956f3c27ba124d6dc456a723c7670 (Closed)
Patch Set: fix build.gn Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return; 183 return;
184 } 184 }
185 } 185 }
186 } 186 }
187 187
188 void CrashReportUploadThread::ProcessPendingReport( 188 void CrashReportUploadThread::ProcessPendingReport(
189 const CrashReportDatabase::Report& report) { 189 const CrashReportDatabase::Report& report) {
190 Settings* const settings = database_->GetSettings(); 190 Settings* const settings = database_->GetSettings();
191 191
192 bool uploads_enabled; 192 bool uploads_enabled;
193 if (!settings->GetUploadsEnabled(&uploads_enabled) || 193 if (url_.empty() ||
194 !uploads_enabled || 194 (!report.upload_explicitly_requested &&
195 url_.empty()) { 195 (!settings->GetUploadsEnabled(&uploads_enabled) || !uploads_enabled))) {
196 // If the upload-enabled state can’t be determined, uploads are disabled, or 196 // Don’t attempt an upload if there’s no URL to upload to. Allow upload if
197 // there’s no URL to upload to, don’t attempt to upload the new report. 197 // it has been explicitly requested by the user, otherwise, respect the
198 // upload-enabled state stored in the database’s settings.
198 database_->SkipReportUpload(report.uuid); 199 database_->SkipReportUpload(report.uuid);
199 return; 200 return;
200 } 201 }
201 202
202 // This currently implements very simplistic rate-limiting, compatible with 203 // This currently implements very simplistic rate-limiting, compatible with
203 // the Breakpad client, where the strategy is to permit one upload attempt per 204 // the Breakpad client, where the strategy is to permit one upload attempt per
204 // hour, and retire reports that would exceed this limit or for which the 205 // hour, and retire reports that would exceed this limit or for which the
205 // upload fails on the first attempt. 206 // upload fails on the first attempt.
206 // 207 //
207 // TODO(mark): Provide a proper rate-limiting strategy and allow for failed 208 // TODO(mark): Provide a proper rate-limiting strategy and allow for failed
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 case CrashReportDatabase::kBusyError: 245 case CrashReportDatabase::kBusyError:
245 return; 246 return;
246 247
247 case CrashReportDatabase::kReportNotFound: 248 case CrashReportDatabase::kReportNotFound:
248 case CrashReportDatabase::kFileSystemError: 249 case CrashReportDatabase::kFileSystemError:
249 case CrashReportDatabase::kDatabaseError: 250 case CrashReportDatabase::kDatabaseError:
250 // In these cases, SkipReportUpload() might not work either, but it’s best 251 // In these cases, SkipReportUpload() might not work either, but it’s best
251 // to at least try to get the report out of the way. 252 // to at least try to get the report out of the way.
252 database_->SkipReportUpload(report.uuid); 253 database_->SkipReportUpload(report.uuid);
253 return; 254 return;
255
256 case CrashReportDatabase::kCannotRequestUpload:
257 NOTREACHED();
258 return;
254 } 259 }
255 260
256 CallRecordUploadAttempt call_record_upload_attempt(database_, upload_report); 261 CallRecordUploadAttempt call_record_upload_attempt(database_, upload_report);
257 262
258 std::string response_body; 263 std::string response_body;
259 UploadResult upload_result = UploadReport(upload_report, &response_body); 264 UploadResult upload_result = UploadReport(upload_report, &response_body);
260 switch (upload_result) { 265 switch (upload_result) {
261 case UploadResult::kSuccess: 266 case UploadResult::kSuccess:
262 call_record_upload_attempt.Disarm(); 267 call_record_upload_attempt.Disarm();
263 database_->RecordUploadAttempt(upload_report, true, response_body); 268 database_->RecordUploadAttempt(upload_report, true, response_body);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 335 }
331 336
332 return UploadResult::kSuccess; 337 return UploadResult::kSuccess;
333 } 338 }
334 339
335 void CrashReportUploadThread::DoWork(const WorkerThread* thread) { 340 void CrashReportUploadThread::DoWork(const WorkerThread* thread) {
336 ProcessPendingReports(); 341 ProcessPendingReports();
337 } 342 }
338 343
339 } // namespace crashpad 344 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698