Commit c81955d5 authored by kylechar's avatar kylechar Committed by Commit Bot

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: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654577}
parent 39de8c9b
...@@ -255,19 +255,15 @@ void ImportantFileWriter::WriteNow(std::unique_ptr<std::string> data) { ...@@ -255,19 +255,15 @@ void ImportantFileWriter::WriteNow(std::unique_ptr<std::string> data) {
return; return;
} }
Closure task = AdaptCallbackForRepeating( auto task =
BindOnce(&WriteScopedStringToFileAtomically, path_, std::move(data), BindOnce(&WriteScopedStringToFileAtomically, path_, std::move(data),
std::move(before_next_write_callback_), 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))) { // If PostTask() returns false, it means that |task_runner_| isn't
// Posting the task to background message loop is not expected // BLOCK_SHUTDOWN and thus isn't appropriate to write an important file.
// to fail, but if it does, avoid losing data and just hit the disk CHECK(task_runner_->PostTask(FROM_HERE, std::move(task)));
// on the current thread.
NOTREACHED();
task.Run();
}
ClearPendingWrite(); ClearPendingWrite();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment