[base] Apply BindOnceRewriter in //remoting
This change applies the BindOnceRewriter in //remoting.
This rewriter replaces calls to base::Bind and base::BindRepeating with
calls to base::BindOnce, in case the result is immediately assigned to a
base::OnceCallback. Given that base::RepeatingCallback is implicitly
convertible to base::OnceCallback, there is no change in functionality.
Steps:
1. run_tool.py --tool base_bind_rewriters \
--tool-arg='--rewriter=bind_to_bind_once'
2. git cl format
This CL was uploaded by git cl split.
[email protected]
Bug: 714018
Change-Id: I34f580a97431487d7b438a9cc4bf4640611b311a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132152
Auto-Submit: Jan Wilken Dörrie <[email protected]>
Reviewed-by: Lambros Lambrou <[email protected]>
Commit-Queue: Lambros Lambrou <[email protected]>
Cr-Commit-Position: refs/heads/master@{#755452}
diff --git a/remoting/protocol/connection_tester.cc b/remoting/protocol/connection_tester.cc
index 59e6c21..301e242 100644
--- a/remoting/protocol/connection_tester.cc
+++ b/remoting/protocol/connection_tester.cc
@@ -73,10 +73,11 @@
int bytes_to_write = std::min(output_buffer_->BytesRemaining(),
message_size_);
- result = client_socket_->Write(
- output_buffer_.get(), bytes_to_write,
- base::Bind(&StreamConnectionTester::OnWritten, base::Unretained(this)),
- TRAFFIC_ANNOTATION_FOR_TESTS);
+ result =
+ client_socket_->Write(output_buffer_.get(), bytes_to_write,
+ base::BindOnce(&StreamConnectionTester::OnWritten,
+ base::Unretained(this)),
+ TRAFFIC_ANNOTATION_FOR_TESTS);
HandleWriteResult(result);
}
}
@@ -100,10 +101,9 @@
int result = 1;
while (result > 0) {
input_buffer_->SetCapacity(input_buffer_->offset() + message_size_);
- result = host_socket_->Read(
- input_buffer_.get(),
- message_size_,
- base::Bind(&StreamConnectionTester::OnRead, base::Unretained(this)));
+ result = host_socket_->Read(input_buffer_.get(), message_size_,
+ base::BindOnce(&StreamConnectionTester::OnRead,
+ base::Unretained(this)));
HandleReadResult(result);
};
}