diff options
author | kylechar <kylechar@chromium.org> | 2019-04-27 05:15:02 +0900 |
---|---|---|
committer | Qijiang Fan <fqj@google.com> | 2020-06-05 12:54:35 +0900 |
commit | dbc16ff05eb55788f4db456609d755cc1c6d56ea (patch) | |
tree | f77145655b8c3f7dd70d878602f96a5606782dea /base | |
parent | 5110430efddbf350e57d31d597a30270828e665f (diff) | |
download | libchrome-dbc16ff05eb55788f4db456609d755cc1c6d56ea.tar.gz |
Remove AdaptCallbackForRepeating() in ImportantFileWriter.
If posting the task fails then it's not an appropriate task runner. See
https://crrev.com/c/1572809/3/base/files/important_file_writer.cc#258
for more context.
Bug: 714018
Change-Id: I620bd978ec2a1d6b6219fa3d85ac6fbcd5563af2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1580041
Commit-Queue: kylechar <kylechar@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654577}
CrOS-Libchrome-Original-Commit: c81955d58df6259b5751233400cd217258197543
Diffstat (limited to 'base')
-rw-r--r-- | base/files/important_file_writer.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc index 2a9ef4f932..bb0c1a2a98 100644 --- a/base/files/important_file_writer.cc +++ b/base/files/important_file_writer.cc @@ -255,19 +255,15 @@ void ImportantFileWriter::WriteNow(std::unique_ptr<std::string> data) { return; } - Closure task = AdaptCallbackForRepeating( + auto task = BindOnce(&WriteScopedStringToFileAtomically, path_, std::move(data), std::move(before_next_write_callback_), - std::move(after_next_write_callback_), histogram_suffix_)); + std::move(after_next_write_callback_), histogram_suffix_); - if (!task_runner_->PostTask(FROM_HERE, MakeCriticalClosure(task))) { - // Posting the task to background message loop is not expected - // to fail, but if it does, avoid losing data and just hit the disk - // on the current thread. - NOTREACHED(); + // If PostTask() returns false, it means that |task_runner_| isn't + // BLOCK_SHUTDOWN and thus isn't appropriate to write an important file. + CHECK(task_runner_->PostTask(FROM_HERE, std::move(task))); - task.Run(); - } ClearPendingWrite(); } |