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

Side by Side Diff: chrome/browser/feedback/feedback_uploader.h

Issue 186903003: Merge 254314 "Fix race condition in uploading feedback reports." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1847/src/
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/feedback/feedback_report.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_H_ 5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_H_
6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_H_ 6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 private: 39 private:
40 friend class FeedbackUploaderTest; 40 friend class FeedbackUploaderTest;
41 struct ReportsUploadTimeComparator { 41 struct ReportsUploadTimeComparator {
42 bool operator()(FeedbackReport* a, FeedbackReport* b) const; 42 bool operator()(FeedbackReport* a, FeedbackReport* b) const;
43 }; 43 };
44 44
45 // Dispatches the report to be uploaded. 45 // Dispatches the report to be uploaded.
46 void DispatchReport(const std::string& data); 46 void DispatchReport(const std::string& data);
47 47
48 // Loads any unsent reports from disk and queues them to be uploaded in
49 // the given browser context.
50 void QueueUnsentReports(content::BrowserContext* context);
51
52 // Update our timer for uploading the next report. 48 // Update our timer for uploading the next report.
53 void UpdateUploadTimer(); 49 void UpdateUploadTimer();
54 50
55 // Requeue this report with a delay. 51 // Requeue this report with a delay.
56 void RetryReport(const std::string& data); 52 void RetryReport(const std::string& data);
57 53
58 void setup_for_test(const ReportDataCallback& dispatch_callback, 54 void setup_for_test(const ReportDataCallback& dispatch_callback,
59 const base::TimeDelta& retry_delay); 55 const base::TimeDelta& retry_delay);
60 56
61 // Browser context this uploader was created for. 57 // Browser context this uploader was created for.
62 content::BrowserContext* context_; 58 content::BrowserContext* context_;
63 // Timer to upload the next report at. 59 // Timer to upload the next report at.
64 base::OneShotTimer<FeedbackUploader> upload_timer_; 60 base::OneShotTimer<FeedbackUploader> upload_timer_;
65 // Priority queue of reports prioritized by the time the report is supposed 61 // Priority queue of reports prioritized by the time the report is supposed
66 // to be uploaded at. 62 // to be uploaded at.
67 std::priority_queue<scoped_refptr<FeedbackReport>, 63 std::priority_queue<scoped_refptr<FeedbackReport>,
68 std::vector<scoped_refptr<FeedbackReport> >, 64 std::vector<scoped_refptr<FeedbackReport> >,
69 ReportsUploadTimeComparator> reports_queue_; 65 ReportsUploadTimeComparator> reports_queue_;
70 66
71 ReportDataCallback dispatch_callback_; 67 ReportDataCallback dispatch_callback_;
72 base::TimeDelta retry_delay_; 68 base::TimeDelta retry_delay_;
73 69
74 DISALLOW_COPY_AND_ASSIGN(FeedbackUploader); 70 DISALLOW_COPY_AND_ASSIGN(FeedbackUploader);
75 }; 71 };
76 72
77 } // namespace feedback 73 } // namespace feedback
78 74
79 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_H_ 75 #endif // CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/feedback/feedback_report.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698