| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 //! upload attempts for reports left in the pending state to be retried. It also | 36 //! upload attempts for reports left in the pending state to be retried. It also |
| 37 //! catches reports that are added without a ReportPending() signal being | 37 //! catches reports that are added without a ReportPending() signal being |
| 38 //! caught. This may happen if crash reports are added to the database by other | 38 //! caught. This may happen if crash reports are added to the database by other |
| 39 //! processes. | 39 //! processes. |
| 40 class CrashReportUploadThread : public WorkerThread::Delegate { | 40 class CrashReportUploadThread : public WorkerThread::Delegate { |
| 41 public: | 41 public: |
| 42 //! \brief Constructs a new object. | 42 //! \brief Constructs a new object. |
| 43 //! | 43 //! |
| 44 //! \param[in] database The database to upload crash reports from. | 44 //! \param[in] database The database to upload crash reports from. |
| 45 //! \param[in] url The URL of the server to upload crash reports to. | 45 //! \param[in] url The URL of the server to upload crash reports to. |
| 46 //! \param[in] rate_limit Whether uploads should be throttled to a (currently |
| 47 //! hardcoded) rate. |
| 46 CrashReportUploadThread(CrashReportDatabase* database, | 48 CrashReportUploadThread(CrashReportDatabase* database, |
| 47 const std::string& url); | 49 const std::string& url, |
| 50 bool rate_limit); |
| 48 ~CrashReportUploadThread(); | 51 ~CrashReportUploadThread(); |
| 49 | 52 |
| 50 //! \brief Starts a dedicated upload thread, which executes ThreadMain(). | 53 //! \brief Starts a dedicated upload thread, which executes ThreadMain(). |
| 51 //! | 54 //! |
| 52 //! This method may only be be called on a newly-constructed object or after | 55 //! This method may only be be called on a newly-constructed object or after |
| 53 //! a call to Stop(). | 56 //! a call to Stop(). |
| 54 void Start(); | 57 void Start(); |
| 55 | 58 |
| 56 //! \brief Stops the upload thread. | 59 //! \brief Stops the upload thread. |
| 57 //! | 60 //! |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 std::string* response_body); | 131 std::string* response_body); |
| 129 | 132 |
| 130 // WorkerThread::Delegate: | 133 // WorkerThread::Delegate: |
| 131 //! \brief Calls ProcessPendingReports() in response to ReportPending() having | 134 //! \brief Calls ProcessPendingReports() in response to ReportPending() having |
| 132 //! been called on any thread, as well as periodically on a timer. | 135 //! been called on any thread, as well as periodically on a timer. |
| 133 void DoWork(const WorkerThread* thread) override; | 136 void DoWork(const WorkerThread* thread) override; |
| 134 | 137 |
| 135 std::string url_; | 138 std::string url_; |
| 136 WorkerThread thread_; | 139 WorkerThread thread_; |
| 137 CrashReportDatabase* database_; // weak | 140 CrashReportDatabase* database_; // weak |
| 141 bool rate_limit_; |
| 138 | 142 |
| 139 DISALLOW_COPY_AND_ASSIGN(CrashReportUploadThread); | 143 DISALLOW_COPY_AND_ASSIGN(CrashReportUploadThread); |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace crashpad | 146 } // namespace crashpad |
| 143 | 147 |
| 144 #endif // CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_ | 148 #endif // CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_ |
| OLD | NEW |