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 0bd8a7fd358f037ba26a8768a46b55627a112be3..577bb5ea8eaf3b1aaa04b48d41473ded78908219 100644 |
| --- a/base/files/important_file_writer.h |
| +++ b/base/files/important_file_writer.h |
| @@ -95,10 +95,16 @@ class BASE_EXPORT ImportantFileWriter : public NonThreadSafe { |
| // Serialize data pending to be saved and execute write on backend thread. |
| void DoScheduledWrite(); |
| - // Registers |on_next_successful_write| to be called once, on the next |
| - // successful write event. Only one callback can be set at once. |
| - void RegisterOnNextSuccessfulWriteCallback( |
| - const Closure& on_next_successful_write); |
| + // Registers |on_next_successful_write_reply| to be invoked on the sequence |
| + // owning this ImportantFileWriter in reply to the next successful write. |
|
gab
2016/08/08 04:37:44
+ "Only one such callback can be set at once."
he
proberge
2016/08/31 17:30:15
Done.
|
| + void RegisterOnNextSuccessfulWriteReply( |
|
gab
2016/08/08 04:37:44
Need to update important_file_writer_unittest.cc
proberge
2016/08/31 17:30:15
Done.
|
| + const Closure& on_next_successful_write_reply); |
| + |
| + // Registers |on_next_write_callback| to be synchronously invoked from |
| + // WriteFileAtomically() on its next write (i.e. from |task_runner_|), with |
| + // |success| indicating whether it succeeded or not. |
| + void RegisterOnNextWriteSynchronousCallback( |
|
gab
2016/08/08 04:37:44
Update CL description to explain why this is requi
proberge
2016/08/31 17:30:15
Acknowledged. Will be done in precursor CL.
|
| + const Callback<void(bool success)>& on_next_write_callback); |
|
gab
2016/08/08 04:37:44
Add test in important_file_writer_unittest.cc
proberge
2016/08/31 17:30:15
Done.
|
| TimeDelta commit_interval() const { |
| return commit_interval_; |
| @@ -113,7 +119,10 @@ class BASE_EXPORT ImportantFileWriter : public NonThreadSafe { |
| void ForwardSuccessfulWrite(bool result); |
| // Invoked once and then reset on the next successful write event. |
| - Closure on_next_successful_write_; |
| + Closure on_next_successful_write_reply_; |
| + |
| + // Invoked synchronously on the next write event. |
| + Callback<void(bool success)> on_next_write_callback_; |
| // Path being written to. |
| const FilePath path_; |