Index: mojo/services/network/http_connection_impl.cc |
diff --git a/mojo/services/network/http_connection_impl.cc b/mojo/services/network/http_connection_impl.cc |
index 2d23f5f1af69086314401595ece20aecb271e1fb..d94034e454fd3cc58c95a5c90e14024950b7d89a 100644 |
--- a/mojo/services/network/http_connection_impl.cc |
+++ b/mojo/services/network/http_connection_impl.cc |
@@ -5,6 +5,7 @@ |
#include "mojo/services/network/http_connection_impl.h" |
#include <limits> |
+#include <utility> |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
@@ -42,7 +43,7 @@ class HttpConnectionImpl::SimpleDataPipeReader { |
void Start(ScopedDataPipeConsumerHandle consumer, |
const CompletionCallback& completion_callback) { |
DCHECK(consumer.is_valid() && !consumer_.is_valid()); |
- consumer_ = consumer.Pass(); |
+ consumer_ = std::move(consumer); |
completion_callback_ = completion_callback; |
buffer_.reset(new std::string); |
ReadMore(); |
@@ -62,7 +63,7 @@ class HttpConnectionImpl::SimpleDataPipeReader { |
WaitToReadMore(); |
} else if (rv == MOJO_RESULT_FAILED_PRECONDITION) { |
// We reached end-of-file. |
- completion_callback_.Run(this, buffer_.Pass()); |
+ completion_callback_.Run(this, std::move(buffer_)); |
// Note: This object may have been destroyed in the callback. |
} else { |
CHECK(false); |
@@ -94,9 +95,9 @@ class HttpConnectionImpl::WebSocketImpl : public WebSocket { |
ScopedDataPipeConsumerHandle send_stream, |
WebSocketClientPtr client) |
: connection_(connection), |
- binding_(this, request.Pass()), |
- client_(client.Pass()), |
- send_stream_(send_stream.Pass()), |
+ binding_(this, std::move(request)), |
+ client_(std::move(client)), |
+ send_stream_(std::move(send_stream)), |
read_send_stream_(new WebSocketReadQueue(send_stream_.get())), |
pending_send_count_(0) { |
DCHECK(binding_.is_bound()); |
@@ -107,10 +108,10 @@ class HttpConnectionImpl::WebSocketImpl : public WebSocket { |
client_.set_connection_error_handler([this]() { Close(); }); |
DataPipe data_pipe; |
- receive_stream_ = data_pipe.producer_handle.Pass(); |
+ receive_stream_ = std::move(data_pipe.producer_handle); |
write_receive_stream_.reset(new WebSocketWriteQueue(receive_stream_.get())); |
- client_->DidConnect("", "", data_pipe.consumer_handle.Pass()); |
+ client_->DidConnect("", "", std::move(data_pipe.consumer_handle)); |
} |
~WebSocketImpl() override {} |
@@ -231,7 +232,7 @@ struct TypeConverter<HttpRequestPtr, net::HttpServerRequestInfo> { |
HttpHeaderPtr header(HttpHeader::New()); |
header->name = item.first; |
header->value = item.second; |
- request->headers[index++] = header.Pass(); |
+ request->headers[index++] = std::move(header); |
} |
if (!obj.data.empty()) { |
uint32_t num_bytes = static_cast<uint32_t>(obj.data.size()); |
@@ -241,13 +242,13 @@ struct TypeConverter<HttpRequestPtr, net::HttpServerRequestInfo> { |
options.element_num_bytes = 1; |
options.capacity_num_bytes = num_bytes; |
DataPipe data_pipe(options); |
- request->body = data_pipe.consumer_handle.Pass(); |
+ request->body = std::move(data_pipe.consumer_handle); |
MojoResult result = |
WriteDataRaw(data_pipe.producer_handle.get(), obj.data.data(), |
&num_bytes, MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); |
CHECK_EQ(MOJO_RESULT_OK, result); |
} |
- return request.Pass(); |
+ return request; |
} |
}; |
@@ -257,7 +258,7 @@ HttpConnectionImpl::HttpConnectionImpl(int connection_id, |
HttpConnectionPtr* connection) |
: connection_id_(connection_id), |
server_(server), |
- delegate_(delegate.Pass()), |
+ delegate_(std::move(delegate)), |
binding_(this, connection) { |
DCHECK(delegate_); |
binding_.set_connection_error_handler([this]() { Close(); }); |
@@ -278,13 +279,13 @@ void HttpConnectionImpl::OnReceivedHttpRequest( |
if (response->body.is_valid()) { |
SimpleDataPipeReader* reader = new SimpleDataPipeReader; |
response_body_readers_.insert(reader); |
- ScopedDataPipeConsumerHandle body = response->body.Pass(); |
+ ScopedDataPipeConsumerHandle body = std::move(response->body); |
reader->Start( |
- body.Pass(), |
+ std::move(body), |
base::Bind(&HttpConnectionImpl::OnFinishedReadingResponseBody, |
base::Unretained(this), base::Passed(&response))); |
} else { |
- OnFinishedReadingResponseBody(response.Pass(), nullptr, nullptr); |
+ OnFinishedReadingResponseBody(std::move(response), nullptr, nullptr); |
} |
}); |
} |
@@ -305,9 +306,9 @@ void HttpConnectionImpl::OnReceivedWebSocketRequest( |
return; |
} |
- web_socket_.reset(new WebSocketImpl(this, web_socket.Pass(), |
- send_stream.Pass(), |
- web_socket_client.Pass())); |
+ web_socket_.reset(new WebSocketImpl(this, std::move(web_socket), |
+ std::move(send_stream), |
+ std::move(web_socket_client))); |
server_->server()->AcceptWebSocket(connection_id_, info); |
}); |
} |