| 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 26 matching lines...) Expand all Loading... |
| 37 //! upload attempts for reports left in the pending state to be retried. It also | 37 //! upload attempts for reports left in the pending state to be retried. It also |
| 38 //! catches reports that are added without a ReportPending() signal being | 38 //! catches reports that are added without a ReportPending() signal being |
| 39 //! caught. This may happen if crash reports are added to the database by other | 39 //! caught. This may happen if crash reports are added to the database by other |
| 40 //! processes. | 40 //! processes. |
| 41 class CrashReportUploadThread : public WorkerThread::Delegate { | 41 class CrashReportUploadThread : public WorkerThread::Delegate { |
| 42 public: | 42 public: |
| 43 //! \brief Constructs a new object. | 43 //! \brief Constructs a new object. |
| 44 //! | 44 //! |
| 45 //! \param[in] database The database to upload crash reports from. | 45 //! \param[in] database The database to upload crash reports from. |
| 46 //! \param[in] url The URL of the server to upload crash reports to. | 46 //! \param[in] url The URL of the server to upload crash reports to. |
| 47 //! \param[in] rate_limit Whether uploads should be throttled to a (currently |
| 48 //! hardcoded) rate. |
| 47 CrashReportUploadThread(CrashReportDatabase* database, | 49 CrashReportUploadThread(CrashReportDatabase* database, |
| 48 const std::string& url); | 50 const std::string& url, |
| 51 bool rate_limit); |
| 49 ~CrashReportUploadThread(); | 52 ~CrashReportUploadThread(); |
| 50 | 53 |
| 51 //! \brief Starts a dedicated upload thread, which executes ThreadMain(). | 54 //! \brief Starts a dedicated upload thread, which executes ThreadMain(). |
| 52 //! | 55 //! |
| 53 //! This method may only be be called on a newly-constructed object or after | 56 //! This method may only be be called on a newly-constructed object or after |
| 54 //! a call to Stop(). | 57 //! a call to Stop(). |
| 55 void Start(); | 58 void Start(); |
| 56 | 59 |
| 57 //! \brief Stops the upload thread. | 60 //! \brief Stops the upload thread. |
| 58 //! | 61 //! |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 std::string* response_body); | 132 std::string* response_body); |
| 130 | 133 |
| 131 // WorkerThread::Delegate: | 134 // WorkerThread::Delegate: |
| 132 //! \brief Calls ProcessPendingReports() in response to ReportPending() having | 135 //! \brief Calls ProcessPendingReports() in response to ReportPending() having |
| 133 //! been called on any thread, as well as periodically on a timer. | 136 //! been called on any thread, as well as periodically on a timer. |
| 134 void DoWork(const WorkerThread* thread) override; | 137 void DoWork(const WorkerThread* thread) override; |
| 135 | 138 |
| 136 std::string url_; | 139 std::string url_; |
| 137 WorkerThread thread_; | 140 WorkerThread thread_; |
| 138 CrashReportDatabase* database_; // weak | 141 CrashReportDatabase* database_; // weak |
| 142 bool rate_limit_; |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 } // namespace crashpad | 145 } // namespace crashpad |
| 142 | 146 |
| 143 #endif // CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_ | 147 #endif // CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_ |
| OLD | NEW |