2016-12-12 11:05:29 +01:00
|
|
|
// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
|
|
|
|
#define CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
|
|
|
|
|
|
|
|
#include "third_party/crashpad/crashpad/handler/crash_report_upload_thread.h"
|
|
|
|
|
|
|
|
class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
|
|
|
|
public:
|
|
|
|
CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
|
|
|
|
const std::string& url,
|
2017-12-07 22:44:24 +01:00
|
|
|
const Options& options,
|
2022-09-26 21:30:45 +02:00
|
|
|
ProcessPendingReportsObservationCallback callback,
|
2016-12-12 11:05:29 +01:00
|
|
|
int max_uploads);
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefCrashReportUploadThread(const CefCrashReportUploadThread&) = delete;
|
|
|
|
CefCrashReportUploadThread& operator=(const CefCrashReportUploadThread&) =
|
|
|
|
delete;
|
|
|
|
|
2016-12-12 11:05:29 +01:00
|
|
|
~CefCrashReportUploadThread();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ProcessPendingReports() override;
|
|
|
|
void ProcessPendingReport(
|
2017-05-17 11:29:28 +02:00
|
|
|
const crashpad::CrashReportDatabase::Report& report) override;
|
2018-02-15 01:12:09 +01:00
|
|
|
ParameterMap FilterParameters(const ParameterMap& parameters) override;
|
2016-12-12 11:05:29 +01:00
|
|
|
|
|
|
|
bool UploadsEnabled() const;
|
|
|
|
|
|
|
|
bool MaxUploadsEnabled() const;
|
|
|
|
bool MaxUploadsExceeded() const;
|
|
|
|
|
|
|
|
bool BackoffPending() const;
|
|
|
|
void IncreaseBackoff();
|
|
|
|
void ResetBackoff();
|
|
|
|
|
|
|
|
int max_uploads_;
|
|
|
|
|
|
|
|
// Track the number of uploads that have completed within the last 24 hours.
|
|
|
|
// Only used when RateLimitEnabled() is true. Value is reset each time
|
|
|
|
// ProcessPendingReports() is called.
|
|
|
|
int recent_upload_ct_ = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
|