Chromium Code Reviews| 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_; |