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

Unified Diff: base/files/important_file_writer.h

Issue 2920223002: Add additional histograms with suffixes to ImportantFileWriter. (Closed)
Patch Set: Fix histogram suffix to use string reference instead of StringPiece. Created 3 years, 6 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
« no previous file with comments | « no previous file | base/files/important_file_writer.cc » ('j') | base/files/important_file_writer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/important_file_writer.h
diff --git a/base/files/important_file_writer.h b/base/files/important_file_writer.h
index 5fcd5153c28ae49830760b7ef9aec19aca4479cb..c10055e6cacf0b5338f1f07f1595a89277e48387 100644
--- a/base/files/important_file_writer.h
+++ b/base/files/important_file_writer.h
@@ -53,7 +53,10 @@ class BASE_EXPORT ImportantFileWriter {
// Save |data| to |path| in an atomic manner. Blocks and writes data on the
// current thread. Does not guarantee file integrity across system crash (see
// the class comment above).
- static bool WriteFileAtomically(const FilePath& path, StringPiece data);
+ static bool WriteFileAtomically(
+ const FilePath& path,
+ StringPiece data,
+ const std::string& histogram_suffix = std::string());
dcheng 2017/06/19 20:27:55 OK, I misread the code and thought this was an int
xaerox 2017/06/20 04:21:00 Done.
// Initialize the writer.
// |path| is the name of file to write.
@@ -61,12 +64,14 @@ class BASE_EXPORT ImportantFileWriter {
// execute file I/O operations.
// All non-const methods, ctor and dtor must be called on the same thread.
ImportantFileWriter(const FilePath& path,
- scoped_refptr<SequencedTaskRunner> task_runner);
+ scoped_refptr<SequencedTaskRunner> task_runner,
+ const char* histogram_suffix = nullptr);
// Same as above, but with a custom commit interval.
ImportantFileWriter(const FilePath& path,
scoped_refptr<SequencedTaskRunner> task_runner,
- TimeDelta interval);
+ TimeDelta interval,
+ const char* histogram_suffix = nullptr);
// You have to ensure that there are no pending writes at the moment
// of destruction.
@@ -143,6 +148,9 @@ class BASE_EXPORT ImportantFileWriter {
// Time delta after which scheduled data will be written to disk.
const TimeDelta commit_interval_;
+ // Custom histogram suffix.
+ const std::string histogram_suffix_;
+
SEQUENCE_CHECKER(sequence_checker_);
WeakPtrFactory<ImportantFileWriter> weak_factory_;
« no previous file with comments | « no previous file | base/files/important_file_writer.cc » ('j') | base/files/important_file_writer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698