• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
6 #define CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
7 
8 #include "third_party/crashpad/crashpad/handler/crash_report_upload_thread.h"
9 
10 class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
11  public:
12   CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
13                              const std::string& url,
14                              const Options& options,
15                              int max_uploads);
16 
17   CefCrashReportUploadThread(const CefCrashReportUploadThread&) = delete;
18   CefCrashReportUploadThread& operator=(const CefCrashReportUploadThread&) =
19       delete;
20 
21   ~CefCrashReportUploadThread();
22 
23  private:
24   void ProcessPendingReports() override;
25   void ProcessPendingReport(
26       const crashpad::CrashReportDatabase::Report& report) override;
27   ParameterMap FilterParameters(const ParameterMap& parameters) override;
28 
29   bool UploadsEnabled() const;
30 
31   bool MaxUploadsEnabled() const;
32   bool MaxUploadsExceeded() const;
33 
34   bool BackoffPending() const;
35   void IncreaseBackoff();
36   void ResetBackoff();
37 
38   int max_uploads_;
39 
40   // Track the number of uploads that have completed within the last 24 hours.
41   // Only used when RateLimitEnabled() is true. Value is reset each time
42   // ProcessPendingReports() is called.
43   int recent_upload_ct_ = 0;
44 };
45 
46 #endif  // CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
47