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

Side by Side Diff: components/feedback/feedback_report.cc

Issue 2242833003: Add the most recent crash report IDs to feedback reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert back to a const rather than a constexpr Created 4 years, 3 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
« no previous file with comments | « components/feedback/feedback_report.h ('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 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 "components/feedback/feedback_report.h" 5 #include "components/feedback/feedback_report.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/important_file_writer.h" 10 #include "base/files/important_file_writer.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 reports_task_runner_(task_runner) { 47 reports_task_runner_(task_runner) {
48 if (reports_path_.empty()) 48 if (reports_path_.empty())
49 return; 49 return;
50 file_ = reports_path_.AppendASCII( 50 file_ = reports_path_.AppendASCII(
51 kFeedbackReportFilenamePrefix + base::GenerateGUID()); 51 kFeedbackReportFilenamePrefix + base::GenerateGUID());
52 52
53 reports_task_runner_->PostTask(FROM_HERE, base::Bind( 53 reports_task_runner_->PostTask(FROM_HERE, base::Bind(
54 &WriteReportOnBlockingPool, reports_path_, file_, data_)); 54 &WriteReportOnBlockingPool, reports_path_, file_, data_));
55 } 55 }
56 56
57 FeedbackReport::~FeedbackReport() {} 57 // static
58 58 const char FeedbackReport::kCrashReportIdsKey[] = "crash_report_ids";
59 void FeedbackReport::DeleteReportOnDisk() {
60 reports_task_runner_->PostTask(FROM_HERE, base::Bind(
61 base::IgnoreResult(&base::DeleteFile), file_, false));
62 }
63 59
64 // static 60 // static
65 void FeedbackReport::LoadReportsAndQueue( 61 void FeedbackReport::LoadReportsAndQueue(
66 const base::FilePath& user_dir, QueueCallback callback) { 62 const base::FilePath& user_dir, QueueCallback callback) {
67 if (user_dir.empty()) 63 if (user_dir.empty())
68 return; 64 return;
69 65
70 base::FileEnumerator enumerator(user_dir, 66 base::FileEnumerator enumerator(user_dir,
71 false, 67 false,
72 base::FileEnumerator::FILES, 68 base::FileEnumerator::FILES,
73 kFeedbackReportFilenameWildcard); 69 kFeedbackReportFilenameWildcard);
74 for (base::FilePath name = enumerator.Next(); 70 for (base::FilePath name = enumerator.Next();
75 !name.empty(); 71 !name.empty();
76 name = enumerator.Next()) { 72 name = enumerator.Next()) {
77 std::string data; 73 std::string data;
78 if (ReadFileToString(name, &data)) 74 if (ReadFileToString(name, &data))
79 callback.Run(data); 75 callback.Run(data);
80 base::DeleteFile(name, false); 76 base::DeleteFile(name, false);
81 } 77 }
82 } 78 }
83 79
80 void FeedbackReport::DeleteReportOnDisk() {
81 reports_task_runner_->PostTask(
82 FROM_HERE,
83 base::Bind(base::IgnoreResult(&base::DeleteFile), file_, false));
84 }
85
86 FeedbackReport::~FeedbackReport() {}
87
84 } // namespace feedback 88 } // namespace feedback
OLDNEW
« no previous file with comments | « components/feedback/feedback_report.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698