mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update source files for bracket style
This commit is contained in:
@ -45,8 +45,9 @@ void CefCrashReportUploadThread::ProcessPendingReports() {
|
||||
// Count how many reports have completed in the last 24 hours.
|
||||
recent_upload_ct_ = 0;
|
||||
for (const CrashReportDatabase::Report& report : reports) {
|
||||
if (report.last_upload_attempt_time > now - kSeconds)
|
||||
if (report.last_upload_attempt_time > now - kSeconds) {
|
||||
recent_upload_ct_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,8 +60,8 @@ void CefCrashReportUploadThread::ProcessPendingReport(
|
||||
// Always allow upload if it's been explicitly requested by the user.
|
||||
if (!report.upload_explicitly_requested) {
|
||||
if (!UploadsEnabled()) {
|
||||
// Don’t attempt an upload if there’s no URL or if uploads have been
|
||||
// disabled in the database’s settings.
|
||||
// Don't attempt an upload if there's no URL or if uploads have been
|
||||
// disabled in the database's settings.
|
||||
database_->SkipReportUpload(
|
||||
report.uuid, Metrics::CrashSkippedReason::kUploadsDisabled);
|
||||
return;
|
||||
@ -92,7 +93,7 @@ void CefCrashReportUploadThread::ProcessPendingReport(
|
||||
case CrashReportDatabase::kReportNotFound:
|
||||
case CrashReportDatabase::kFileSystemError:
|
||||
case CrashReportDatabase::kDatabaseError:
|
||||
// In these cases, SkipReportUpload() might not work either, but it’s best
|
||||
// In these cases, SkipReportUpload() might not work either, but it's best
|
||||
// to at least try to get the report out of the way.
|
||||
database_->SkipReportUpload(report.uuid,
|
||||
Metrics::CrashSkippedReason::kDatabaseError);
|
||||
@ -110,8 +111,9 @@ void CefCrashReportUploadThread::ProcessPendingReport(
|
||||
case UploadResult::kSuccess:
|
||||
// The upload completed successfully.
|
||||
database_->RecordUploadComplete(std::move(upload_report), response_body);
|
||||
if (MaxUploadsEnabled())
|
||||
if (MaxUploadsEnabled()) {
|
||||
recent_upload_ct_++;
|
||||
}
|
||||
ResetBackoff();
|
||||
break;
|
||||
case UploadResult::kPermanentFailure:
|
||||
@ -148,8 +150,9 @@ bool CefCrashReportUploadThread::MaxUploadsExceeded() const {
|
||||
}
|
||||
|
||||
bool CefCrashReportUploadThread::BackoffPending() const {
|
||||
if (!options_.rate_limit)
|
||||
if (!options_.rate_limit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Settings* const settings = database_->GetSettings();
|
||||
|
||||
@ -157,16 +160,18 @@ bool CefCrashReportUploadThread::BackoffPending() const {
|
||||
if (settings->GetNextUploadAttemptTime(&next_upload_time) &&
|
||||
next_upload_time > 0) {
|
||||
const time_t now = time(nullptr);
|
||||
if (now < next_upload_time)
|
||||
if (now < next_upload_time) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
if (!options_.rate_limit)
|
||||
if (!options_.rate_limit) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int kHour = 60 * 60; // 1 hour
|
||||
const int kBackoffSchedule[] = {
|
||||
@ -183,10 +188,12 @@ void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
Settings* settings = database_->GetSettings();
|
||||
|
||||
int backoff_step = 0;
|
||||
if (settings->GetBackoffStep(&backoff_step) && backoff_step < 0)
|
||||
if (settings->GetBackoffStep(&backoff_step) && backoff_step < 0) {
|
||||
backoff_step = 0;
|
||||
if (++backoff_step > kBackoffScheduleSize)
|
||||
}
|
||||
if (++backoff_step > kBackoffScheduleSize) {
|
||||
backoff_step = kBackoffScheduleSize;
|
||||
}
|
||||
|
||||
time_t next_upload_time = time(nullptr); // now
|
||||
next_upload_time += kBackoffSchedule[backoff_step - 1];
|
||||
@ -203,8 +210,9 @@ void CefCrashReportUploadThread::IncreaseBackoff() {
|
||||
}
|
||||
|
||||
void CefCrashReportUploadThread::ResetBackoff() {
|
||||
if (!options_.rate_limit)
|
||||
if (!options_.rate_limit) {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings* settings = database_->GetSettings();
|
||||
settings->SetBackoffStep(0);
|
||||
|
Reference in New Issue
Block a user