Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1037)

Unified Diff: mojo/services/network/net_adapters.cc

Issue 1539863002: Convert Pass()→std::move() in mojo/services/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing forward declare that was masked by pre-existing incorrect #include ordering. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/network/http_server_impl.cc ('k') | mojo/services/network/net_address_type_converters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/net_adapters.cc
diff --git a/mojo/services/network/net_adapters.cc b/mojo/services/network/net_adapters.cc
index 551481d38810370c9968a546fdf5492b2896ab27..8c2a877a997e9f750a84b4419cd6fdb6fc7c8d5d 100644
--- a/mojo/services/network/net_adapters.cc
+++ b/mojo/services/network/net_adapters.cc
@@ -4,6 +4,8 @@
#include "mojo/services/network/net_adapters.h"
+#include <utility>
+
#include "net/base/net_errors.h"
namespace mojo {
@@ -17,9 +19,7 @@ const uint32_t kMaxBufSize = 64 * 1024;
NetToMojoPendingBuffer::NetToMojoPendingBuffer(
ScopedDataPipeProducerHandle handle,
void* buffer)
- : handle_(handle.Pass()),
- buffer_(buffer) {
-}
+ : handle_(std::move(handle)), buffer_(buffer) {}
NetToMojoPendingBuffer::~NetToMojoPendingBuffer() {
if (handle_.is_valid())
@@ -39,7 +39,7 @@ MojoResult NetToMojoPendingBuffer::BeginWrite(
if (result == MOJO_RESULT_OK) {
if (*num_bytes > kMaxBufSize)
*num_bytes = kMaxBufSize;
- *pending = new NetToMojoPendingBuffer(handle->Pass(), buf);
+ *pending = new NetToMojoPendingBuffer(std::move(*handle), buf);
}
return result;
}
@@ -48,7 +48,7 @@ ScopedDataPipeProducerHandle NetToMojoPendingBuffer::Complete(
uint32_t num_bytes) {
EndWriteDataRaw(handle_.get(), num_bytes);
buffer_ = NULL;
- return handle_.Pass();
+ return std::move(handle_);
}
// -----------------------------------------------------------------------------
@@ -67,9 +67,7 @@ NetToMojoIOBuffer::~NetToMojoIOBuffer() {
MojoToNetPendingBuffer::MojoToNetPendingBuffer(
ScopedDataPipeConsumerHandle handle,
const void* buffer)
- : handle_(handle.Pass()),
- buffer_(buffer) {
-}
+ : handle_(std::move(handle)), buffer_(buffer) {}
MojoToNetPendingBuffer::~MojoToNetPendingBuffer() {
}
@@ -84,7 +82,7 @@ MojoResult MojoToNetPendingBuffer::BeginRead(
MojoResult result = BeginReadDataRaw(handle->get(), &buffer, num_bytes,
MOJO_READ_DATA_FLAG_NONE);
if (result == MOJO_RESULT_OK)
- *pending = new MojoToNetPendingBuffer(handle->Pass(), buffer);
+ *pending = new MojoToNetPendingBuffer(std::move(*handle), buffer);
return result;
}
@@ -92,7 +90,7 @@ ScopedDataPipeConsumerHandle MojoToNetPendingBuffer::Complete(
uint32_t num_bytes) {
EndReadDataRaw(handle_.get(), num_bytes);
buffer_ = NULL;
- return handle_.Pass();
+ return std::move(handle_);
}
// -----------------------------------------------------------------------------
@@ -112,7 +110,7 @@ NetworkErrorPtr MakeNetworkError(int error_code) {
error->code = error_code;
if (error_code <= 0)
error->description = net::ErrorToString(error_code);
- return error.Pass();
+ return error;
}
} // namespace mojo
« no previous file with comments | « mojo/services/network/http_server_impl.cc ('k') | mojo/services/network/net_address_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698