Use base::BindOnce for PostTask callbacks.
TaskRunner::PostTask() takes a OnceCallback. Replace usage of
base::Bind(), which produces a RepeatingCallback, with base::BindOnce()
when the callback is created as a temporary inside of PostTask(). The
following regex was used to find instances that could be replaced:
(Post(?:Delayed)?Task)\((?:\n\s*)?FROM_HERE,(?:\n)?\s*base::Bind\(
Also replace any usage of base::Passed(&var) with std::move(var) for
variables passed to base::BindOnce(). base::Passed() isn't needed for
move-only types with OnceCallbacks.
This CL was uploaded by git cl split.
[email protected]
Bug: 714018
Change-Id: I752c22efc5f81b5a7fb6dba1769ca61ecd0f6bd9
Reviewed-on: https://chromium-review.googlesource.com/c/1475647
Auto-Submit: kylechar <[email protected]>
Reviewed-by: Bence Béky <[email protected]>
Commit-Queue: Bence Béky <[email protected]>
Cr-Commit-Position: refs/heads/master@{#632708}
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 3675488..734c258 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -123,8 +123,8 @@
int ReadInternal(IOBuffer* buf, int buf_len) override {
if (async_ == FailureMode::ASYNC) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&ReadErrorUploadDataStream::CompleteRead,
- weak_factory_.GetWeakPtr()));
+ FROM_HERE, base::BindOnce(&ReadErrorUploadDataStream::CompleteRead,
+ weak_factory_.GetWeakPtr()));
return ERR_IO_PENDING;
}
return ERR_FAILED;