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

Unified Diff: handler/crash_report_upload_thread.h

Issue 1526563003: Create WorkerThread, an abstraction to perform some work on an interval. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | handler/crash_report_upload_thread.cc » ('j') | util/thread/worker_thread.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8fff80d70b3310d773e08affaa59a245006395af 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,9 +95,11 @@ class CrashReportUploadThread {
kRetry,
};
+ // WorkerThread::Delegate:
Mark Mentovai 2015/12/15 17:56:58 Can you sort this below UploadReport() (and in the
Robert Sesek 2015/12/23 19:22:31 Done.
+
//! \brief Calls ProcessPendingReports() in response to ReportPending() having
//! been called on any thread, as well as periodically on a timer.
- void ThreadMain();
+ void DoWork(const WorkerThread* thread) override;
//! \brief Obtains all pending reports from the database, and calls
//! ProcessPendingReport() to process each one.
@@ -140,9 +136,7 @@ class CrashReportUploadThread {
std::string url_;
CrashReportDatabase* database_; // weak
- Semaphore semaphore_; // TODO(mark): Use a condition variable instead?
- scoped_ptr<internal::CrashReportUploadHelperThread> thread_;
- bool running_;
+ WorkerThread thread_;
Mark Mentovai 2015/12/15 17:56:58 Sort before the pointer (before or after url_, as
Robert Sesek 2015/12/23 19:22:31 Done.
};
} // namespace crashpad
« no previous file with comments | « no previous file | handler/crash_report_upload_thread.cc » ('j') | util/thread/worker_thread.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698