Index: handler/crash_report_upload_thread.h |
diff --git a/handler/crash_report_upload_thread.h b/handler/crash_report_upload_thread.h |
index 0372a83a3d4d1f2fae859ffcc52ae71d0f2f3eb6..f015ef945498fe7e714d2daa93adb43a01cac44e 100644 |
--- a/handler/crash_report_upload_thread.h |
+++ b/handler/crash_report_upload_thread.h |
@@ -21,14 +21,10 @@ |
#include "base/memory/scoped_ptr.h" |
#include "client/crash_report_database.h" |
-#include "util/synchronization/semaphore.h" |
+#include "util/thread/worker_thread.h" |
namespace crashpad { |
-namespace internal { |
-class CrashReportUploadHelperThread; |
-} // namespace internal |
- |
//! \brief A thread that processes pending crash reports in a |
//! CrashReportDatabase by uploading them or marking them as completed |
//! without upload, as desired. |
@@ -42,7 +38,7 @@ class CrashReportUploadHelperThread; |
//! 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 { |
+class CrashReportUploadThread : public WorkerThread::Delegate { |
public: |
//! \brief Constructs a new object. |
//! |
@@ -79,8 +75,6 @@ class CrashReportUploadThread { |
void ReportPending(); |
private: |
- friend internal::CrashReportUploadHelperThread; |
- |
//! \brief The result code from UploadReport(). |
enum class UploadResult { |
//! \brief The crash report was uploaded successfully. |
@@ -101,10 +95,6 @@ class CrashReportUploadThread { |
kRetry, |
}; |
- //! \brief Calls ProcessPendingReports() in response to ReportPending() having |
- //! been called on any thread, as well as periodically on a timer. |
- void ThreadMain(); |
- |
//! \brief Obtains all pending reports from the database, and calls |
//! ProcessPendingReport() to process each one. |
void ProcessPendingReports(); |
@@ -138,11 +128,14 @@ class CrashReportUploadThread { |
UploadResult UploadReport(const CrashReportDatabase::Report* report, |
std::string* response_body); |
+ // WorkerThread::Delegate: |
+ //! \brief Calls ProcessPendingReports() in response to ReportPending() having |
+ //! been called on any thread, as well as periodically on a timer. |
+ void DoWork(const WorkerThread* thread) override; |
+ |
std::string url_; |
+ WorkerThread thread_; |
CrashReportDatabase* database_; // weak |
- Semaphore semaphore_; // TODO(mark): Use a condition variable instead? |
- scoped_ptr<internal::CrashReportUploadHelperThread> thread_; |
- bool running_; |
}; |
} // namespace crashpad |