summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/files/important_file_writer.cc14
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();
}