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

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

Issue 1127963002: Implement lossy pref behavior for JsonPrefStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs-fix-flags
Patch Set: Created 5 years, 7 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
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 11 matching lines...) Expand all
22 22
23 void WriteReportOnBlockingPool(const base::FilePath reports_path, 23 void WriteReportOnBlockingPool(const base::FilePath reports_path,
24 const base::FilePath& file, 24 const base::FilePath& file,
25 const std::string& data) { 25 const std::string& data) {
26 DCHECK(reports_path.IsParent(file)); 26 DCHECK(reports_path.IsParent(file));
27 if (!base::DirectoryExists(reports_path)) { 27 if (!base::DirectoryExists(reports_path)) {
28 base::File::Error error; 28 base::File::Error error;
29 if (!base::CreateDirectoryAndGetError(reports_path, &error)) 29 if (!base::CreateDirectoryAndGetError(reports_path, &error))
30 return; 30 return;
31 } 31 }
32 base::ImportantFileWriter::WriteFileAtomically(file, data); 32 base::ImportantFileWriterImpl::WriteFileAtomically(file, data);
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 namespace feedback { 37 namespace feedback {
38 38
39 FeedbackReport::FeedbackReport( 39 FeedbackReport::FeedbackReport(
40 const base::FilePath& path, 40 const base::FilePath& path,
41 const base::Time& upload_at, 41 const base::Time& upload_at,
42 const std::string& data, 42 const std::string& data,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 !name.empty(); 75 !name.empty();
76 name = enumerator.Next()) { 76 name = enumerator.Next()) {
77 std::string data; 77 std::string data;
78 if (ReadFileToString(name, &data)) 78 if (ReadFileToString(name, &data))
79 callback.Run(data); 79 callback.Run(data);
80 base::DeleteFile(name, false); 80 base::DeleteFile(name, false);
81 } 81 }
82 } 82 }
83 83
84 } // namespace feedback 84 } // namespace feedback
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698