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..03d832a2457895ea5974e8365aa9668931950bf9 100644 |
| --- a/base/files/important_file_writer.h |
| +++ b/base/files/important_file_writer.h |
| @@ -53,7 +53,9 @@ 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, |
| + std::string histogram_suffix = std::string()); |
|
sky
2017/06/05 16:50:33
const std::string& on all of these.
dcheng
2017/06/05 18:23:59
Or maybe just pass as const char* since it's alway
xaerox
2017/06/07 09:32:54
Acknowledged.
|
| // Initialize the writer. |
| // |path| is the name of file to write. |
| @@ -61,12 +63,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, |
| + std::string histogram_suffix = std::string()); |
| // Same as above, but with a custom commit interval. |
| ImportantFileWriter(const FilePath& path, |
| scoped_refptr<SequencedTaskRunner> task_runner, |
| - TimeDelta interval); |
| + TimeDelta interval, |
| + std::string histogram_suffix = std::string()); |
| // You have to ensure that there are no pending writes at the moment |
| // of destruction. |
| @@ -143,6 +147,9 @@ class BASE_EXPORT ImportantFileWriter { |
| // Time delta after which scheduled data will be written to disk. |
| const TimeDelta commit_interval_; |
| + // Custom histogram suffix. |
| + std::string histogram_suffix_; |
|
sky
2017/06/05 16:50:33
const
xaerox
2017/06/07 09:32:54
Acknowledged.
|
| + |
| SEQUENCE_CHECKER(sequence_checker_); |
| WeakPtrFactory<ImportantFileWriter> weak_factory_; |