A thread that processes pending crash reports in a CrashReportDatabase by uploading them or marking them as completed without upload, as desired. More...
#include "handler/crash_report_upload_thread.h"
Classes | |
struct | Options |
Options to be passed to the CrashReportUploadThread constructor. More... | |
Public Types | |
using | ProcessPendingReportsObservationCallback = std::function<void()> |
Observation callback invoked each time the in-process handler finishes processing and attempting to upload on-disk crash reports (whether or not the uploads succeeded). | |
Public Member Functions | |
CrashReportUploadThread (CrashReportDatabase *database, const std::string &url, const Options &options, ProcessPendingReportsObservationCallback callback) | |
Constructs a new object. | |
CrashReportUploadThread (const CrashReportUploadThread &)=delete | |
CrashReportUploadThread & | operator= (const CrashReportUploadThread &)=delete |
void | ReportPending (const UUID &report_uuid) |
Informs the upload thread that a new pending report has been added to the database. | |
void | Start () override |
Starts a dedicated upload thread, which executes ThreadMain(). | |
void | Stop () override |
Stops the upload thread. | |
bool | is_running () const |
A thread that processes pending crash reports in a CrashReportDatabase by uploading them or marking them as completed without upload, as desired.
A producer of crash reports should notify an object of this class that a new report has been added to the database by calling ReportPending().
Independently of being triggered by ReportPending(), objects of this class 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.
using crashpad::CrashReportUploadThread::ProcessPendingReportsObservationCallback = std::function<void()> |
Observation callback invoked each time the in-process handler finishes processing and attempting to upload on-disk crash reports (whether or not the uploads succeeded).
This callback is copied into this object. Any references or pointers inside must outlive this object.
The callback might be invoked on a background thread, so clients must synchronize appropriately.
crashpad::CrashReportUploadThread::CrashReportUploadThread | ( | CrashReportDatabase * | database, |
const std::string & | url, | ||
const Options & | options, | ||
ProcessPendingReportsObservationCallback | callback ) |
Constructs a new object.
[in] | database | The database to upload crash reports from. |
[in] | url | The URL of the server to upload crash reports to. |
[in] | options | Options for the report uploads. |
[in] | callback | Optional callback invoked zero or more times on a background thread each time the this object finishes processing and attempting to upload on-disk crash reports. If this callback is empty, it is not invoked. |
|
inline |
true
if the thread is running, false
if it is not. void crashpad::CrashReportUploadThread::ReportPending | ( | const UUID & | report_uuid | ) |
Informs the upload thread that a new pending report has been added to the database.
[in] | report_uuid | The unique identifier of the newly added pending report. |
This method may be called from any thread.
|
overridevirtual |
Starts a dedicated upload thread, which executes ThreadMain().
This method may only be be called on a newly-constructed object or after a call to Stop().
Implements crashpad::Stoppable.
|
overridevirtual |
Stops the upload thread.
The upload thread will terminate after completing whatever task it is performing. If it is not performing any task, it will terminate immediately. This method blocks while waiting for the upload thread to terminate.
This method must only be called after Start(). If Start() has been called, this method must be called before destroying an object of this class.
This method may be called from any thread other than the upload thread. It is expected to only be called from the same thread that called Start().
Implements crashpad::Stoppable.