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

Unified Diff: chrome/browser/feedback/feedback_uploader.h

Issue 141433011: Cache feedback reports to disk in case of send failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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
Index: chrome/browser/feedback/feedback_uploader.h
diff --git a/chrome/browser/feedback/feedback_uploader.h b/chrome/browser/feedback/feedback_uploader.h
index 5c31047b1664f102d152805f42545d9252ce40ab..9ddf3a053ebbe3c1fb124c3c21104abecfa6d2b9 100644
--- a/chrome/browser/feedback/feedback_uploader.h
+++ b/chrome/browser/feedback/feedback_uploader.h
@@ -22,7 +22,7 @@ class BrowserContext;
namespace feedback {
-struct FeedbackReport;
+class FeedbackReport;
// FeedbackUploader is used to add a feedback report to the queue of reports
// being uploaded. In case uploading a report fails, it is written to disk and
@@ -33,22 +33,27 @@ class FeedbackUploader : public BrowserContextKeyedService,
explicit FeedbackUploader(content::BrowserContext* context);
virtual ~FeedbackUploader();
- void QueueReport(scoped_ptr<std::string> data);
+ // Queues a report for uploading.
+ void QueueReport(const std::string& data);
private:
friend class FeedbackUploaderTest;
struct ReportsUploadTimeComparator {
- bool operator()(const FeedbackReport& a, const FeedbackReport& b) const;
+ bool operator()(FeedbackReport* a, FeedbackReport* b) const;
};
// Dispatches the report to be uploaded.
- void DispatchReport(scoped_ptr<std::string> data);
+ void DispatchReport(const std::string& data);
+
+ // Loads any unsent reports from disk and queues them to be uploaded in
+ // the given browser context.
+ void QueueUnsentReports(content::BrowserContext* context);
// Update our timer for uploading the next report.
void UpdateUploadTimer();
// Requeue this report with a delay.
- void RetryReport(scoped_ptr<std::string> data);
+ void RetryReport(const std::string& data);
void setup_for_test(const ReportDataCallback& dispatch_callback,
const base::TimeDelta& retry_delay);
@@ -59,12 +64,10 @@ class FeedbackUploader : public BrowserContextKeyedService,
base::OneShotTimer<FeedbackUploader> upload_timer_;
// Priority queue of reports prioritized by the time the report is supposed
// to be uploaded at.
- std::priority_queue<FeedbackReport,
- std::vector<FeedbackReport>,
+ std::priority_queue<scoped_refptr<FeedbackReport>,
+ std::vector<scoped_refptr<FeedbackReport> >,
ReportsUploadTimeComparator> reports_queue_;
- std::vector<FeedbackReport> loaded_reports_;
-
ReportDataCallback dispatch_callback_;
base::TimeDelta retry_delay_;

Powered by Google App Engine
This is Rietveld 408576698