summaryrefslogtreecommitdiff
path: root/chromium/components/feedback/feedback_report.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/feedback/feedback_report.h')
-rw-r--r--chromium/components/feedback/feedback_report.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/chromium/components/feedback/feedback_report.h b/chromium/components/feedback/feedback_report.h
index d3fdb8d3c82..1e330cab9e5 100644
--- a/chromium/components/feedback/feedback_report.h
+++ b/chromium/components/feedback/feedback_report.h
@@ -19,16 +19,19 @@ class SequencedTaskRunner;
namespace feedback {
-typedef base::Callback<void(const std::string&)> QueueCallback;
+// Repeating since for every feedback report file on disk, the callback to
+// queue it in the uploader needs to be invoked.
+using QueueCallback =
+ base::RepeatingCallback<void(std::unique_ptr<std::string>)>;
// This class holds a feedback report. Once a report is created, a disk backup
// for it is created automatically. This backup needs to explicitly be
// deleted by calling DeleteReportOnDisk.
-class FeedbackReport : public base::RefCounted<FeedbackReport> {
+class FeedbackReport : public base::RefCountedThreadSafe<FeedbackReport> {
public:
FeedbackReport(const base::FilePath& path,
const base::Time& upload_at,
- const std::string& data,
+ std::unique_ptr<std::string> data,
scoped_refptr<base::SequencedTaskRunner> task_runner);
// The ID of the product specific data for the crash report IDs as stored by
@@ -38,7 +41,7 @@ class FeedbackReport : public base::RefCounted<FeedbackReport> {
// Loads the reports still on disk and queues then using the given callback.
// This call blocks on the file reads.
static void LoadReportsAndQueue(const base::FilePath& user_dir,
- QueueCallback callback);
+ const QueueCallback& callback);
// Stops the disk write of the report and deletes the report file if already
// written.
@@ -46,10 +49,10 @@ class FeedbackReport : public base::RefCounted<FeedbackReport> {
const base::Time& upload_at() const { return upload_at_; }
void set_upload_at(const base::Time& time) { upload_at_ = time; }
- const std::string& data() const { return data_; }
+ const std::string& data() const { return *data_; }
private:
- friend class base::RefCounted<FeedbackReport>;
+ friend class base::RefCountedThreadSafe<FeedbackReport>;
virtual ~FeedbackReport();
// Name of the file corresponding to this report.
@@ -57,7 +60,7 @@ class FeedbackReport : public base::RefCounted<FeedbackReport> {
base::FilePath reports_path_;
base::Time upload_at_; // Upload this report at or after this time.
- std::string data_;
+ std::unique_ptr<std::string> data_;
scoped_refptr<base::SequencedTaskRunner> reports_task_runner_;