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

Side by Side Diff: chrome/browser/feedback/feedback_report.cc

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.h ('k') | chrome/browser/feedback/feedback_uploader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/feedback/feedback_report.h" 5 #include "chrome/browser/feedback/feedback_report.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/important_file_writer.h" 9 #include "base/files/important_file_writer.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 FeedbackReport::~FeedbackReport() {} 72 FeedbackReport::~FeedbackReport() {}
73 73
74 void FeedbackReport::DeleteReportOnDisk() { 74 void FeedbackReport::DeleteReportOnDisk() {
75 reports_task_runner_->PostTask(FROM_HERE, base::Bind( 75 reports_task_runner_->PostTask(FROM_HERE, base::Bind(
76 base::IgnoreResult(&base::DeleteFile), file_, false)); 76 base::IgnoreResult(&base::DeleteFile), file_, false));
77 } 77 }
78 78
79 // static 79 // static
80 void FeedbackReport::LoadReportsAndQueue( 80 void FeedbackReport::LoadReportsAndQueue(
81 content::BrowserContext* context, QueueCallback callback) { 81 const base::FilePath& user_dir, QueueCallback callback) {
82 base::FilePath reports_path = GetFeedbackReportsPath(context); 82 if (user_dir.empty())
83 if (reports_path.empty())
84 return; 83 return;
85 84
86 base::FileEnumerator enumerator(reports_path, 85 base::FileEnumerator enumerator(user_dir.Append(kFeedbackReportPath),
87 false, 86 false,
88 base::FileEnumerator::FILES, 87 base::FileEnumerator::FILES,
89 kFeedbackReportFilenameWildcard); 88 kFeedbackReportFilenameWildcard);
90 for (base::FilePath name = enumerator.Next(); 89 for (base::FilePath name = enumerator.Next();
91 !name.empty(); 90 !name.empty();
92 name = enumerator.Next()) { 91 name = enumerator.Next()) {
93 std::string data; 92 std::string data;
94 if (ReadFileToString(name, &data)) 93 if (ReadFileToString(name, &data))
95 BrowserThread::PostTask( 94 BrowserThread::PostTask(
96 BrowserThread::UI, FROM_HERE, base::Bind(callback, data)); 95 BrowserThread::UI, FROM_HERE, base::Bind(callback, data));
97 base::DeleteFile(name, false); 96 base::DeleteFile(name, false);
98 } 97 }
99 } 98 }
100 99
101 } // namespace feedback 100 } // namespace feedback
OLDNEW
« no previous file with comments | « chrome/browser/feedback/feedback_report.h ('k') | chrome/browser/feedback/feedback_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698