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

Unified Diff: third_party/crashpad/crashpad/handler/crash_report_upload_thread.h

Issue 2825103002: Update Crashpad to b8aaa22905308cc400f880006a84dddac834bd6b (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/handler/crash_report_upload_thread.h
diff --git a/third_party/crashpad/crashpad/handler/crash_report_upload_thread.h b/third_party/crashpad/crashpad/handler/crash_report_upload_thread.h
index 14debacd1ab840f04176d5dfc266b173acf46101..c769efed5c54c9e94bb209e2a93c5f11a3f674b5 100644
--- a/third_party/crashpad/crashpad/handler/crash_report_upload_thread.h
+++ b/third_party/crashpad/crashpad/handler/crash_report_upload_thread.h
@@ -20,6 +20,8 @@
#include "base/macros.h"
#include "client/crash_report_database.h"
+#include "util/misc/uuid.h"
+#include "util/stdlib/thread_safe_vector.h"
#include "util/thread/worker_thread.h"
namespace crashpad {
@@ -32,22 +34,28 @@ namespace crashpad {
//! report has been added to the database by calling ReportPending().
//!
//! Independently of being triggered by ReportPending(), objects of this class
-//! periodically examine the database for pending reports. This allows failed
-//! upload attempts for reports left in the pending state to be retried. It also
-//! catches reports that are added without a ReportPending() signal being
-//! caught. This may happen if crash reports are added to the database by other
-//! processes.
+//! can periodically examine the database for pending reports. This allows
+//! failed upload attempts for reports left in the pending state to be retried.
+//! It also catches reports that are added without a ReportPending() signal
+//! being caught. This may happen if crash reports are added to the database by
+//! other processes.
class CrashReportUploadThread : public WorkerThread::Delegate {
public:
//! \brief Constructs a new object.
//!
//! \param[in] database The database to upload crash reports from.
//! \param[in] url The URL of the server to upload crash reports to.
+ //! \param[in] watch_pending_reports Whether to periodically check for new
+ //! pending reports not already known to exist. When `false`, only an
+ //! initial upload attempt will be made for reports known to exist by
+ //! having been added by the ReportPending() method. No scans for new
+ //! pending reports will be conducted.
//! \param[in] rate_limit Whether uploads should be throttled to a (currently
//! hardcoded) rate.
//! \param[in] upload_gzip Whether uploads should use `gzip` compression.
CrashReportUploadThread(CrashReportDatabase* database,
const std::string& url,
+ bool watch_pending_reports,
bool rate_limit,
bool upload_gzip);
~CrashReportUploadThread();
@@ -75,8 +83,11 @@ class CrashReportUploadThread : public WorkerThread::Delegate {
//! \brief Informs the upload thread that a new pending report has been added
//! to the database.
//!
+ //! \param[in] report_uuid The unique identifier of the newly added pending
+ //! report.
+ //!
//! This method may be called from any thread.
- void ReportPending();
+ void ReportPending(const UUID& report_uuid);
private:
//! \brief The result code from UploadReport().
@@ -99,8 +110,13 @@ class CrashReportUploadThread : public WorkerThread::Delegate {
kRetry,
};
- //! \brief Obtains all pending reports from the database, and calls
- //! ProcessPendingReport() to process each one.
+ //! \brief Calls ProcessPendingReport() on pending reports.
+ //!
+ //! Assuming Stop() has not been called, this will process reports that the
+ //! object has been made aware of in ReportPending(). Additionally, if the
+ //! object was constructed with \a watch_pending_reports, it will also scan
+ //! the crash report database for other pending reports, and process those as
+ //! well.
void ProcessPendingReports();
//! \brief Processes a single pending report from the database.
@@ -137,11 +153,13 @@ class CrashReportUploadThread : public WorkerThread::Delegate {
//! been called on any thread, as well as periodically on a timer.
void DoWork(const WorkerThread* thread) override;
- std::string url_;
+ const std::string url_;
WorkerThread thread_;
+ ThreadSafeVector<UUID> known_pending_report_uuids_;
CrashReportDatabase* database_; // weak
- bool rate_limit_;
- bool upload_gzip_;
+ const bool watch_pending_reports_;
+ const bool rate_limit_;
+ const bool upload_gzip_;
DISALLOW_COPY_AND_ASSIGN(CrashReportUploadThread);
};

Powered by Google App Engine
This is Rietveld 408576698