Index: base/files/important_file_writer.cc |
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc |
index edd400ce183f13fada7f89ad861c95e5510f7d55..973e3c2bdf10324ac74498f2f4f6a7e6ef96a04a 100644 |
--- a/base/files/important_file_writer.cc |
+++ b/base/files/important_file_writer.cc |
@@ -209,7 +209,7 @@ void ImportantFileWriter::RegisterOnNextSuccessfulWriteCallback( |
on_next_successful_write_ = on_next_successful_write; |
} |
-bool ImportantFileWriter::PostWriteTask(const Callback<bool()>& task) { |
+bool ImportantFileWriter::PostWriteTask(OnceCallback<bool()> task) { |
// TODO(gab): This code could always use PostTaskAndReplyWithResult and let |
// ForwardSuccessfulWrite() no-op if |on_next_successful_write_| is null, but |
// PostTaskAndReply causes memory leaks in tests (crbug.com/371974) and |
@@ -217,15 +217,13 @@ bool ImportantFileWriter::PostWriteTask(const Callback<bool()>& task) { |
// using PostTask() in the typical scenario below. |
if (!on_next_successful_write_.is_null()) { |
return PostTaskAndReplyWithResult( |
- task_runner_.get(), |
- FROM_HERE, |
- MakeCriticalClosure(task), |
+ task_runner_.get(), FROM_HERE, MakeCriticalClosure(std::move(task)), |
Bind(&ImportantFileWriter::ForwardSuccessfulWrite, |
weak_factory_.GetWeakPtr())); |
} |
return task_runner_->PostTask( |
FROM_HERE, |
- MakeCriticalClosure(Bind(IgnoreResult(task)))); |
+ MakeCriticalClosure(BindOnce(IgnoreResult(std::move(task))))); |
} |
void ImportantFileWriter::ForwardSuccessfulWrite(bool result) { |