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

Unified Diff: mojo/edk/system/message_pipe.cc

Issue 1353683005: EDK: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk/system. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 months 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/edk/system/message_pipe.h ('k') | mojo/edk/system/message_pipe_endpoint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe.cc
diff --git a/mojo/edk/system/message_pipe.cc b/mojo/edk/system/message_pipe.cc
index 0f15698a9c7e8328025ddbdd8a176e849355b856..c89e24056bd2f13918587caf89d8016a4574f764 100644
--- a/mojo/edk/system/message_pipe.cc
+++ b/mojo/edk/system/message_pipe.cc
@@ -5,6 +5,7 @@
#include "mojo/edk/system/message_pipe.h"
#include <memory>
+#include <utility>
#include "base/logging.h"
#include "mojo/edk/system/channel.h"
@@ -16,6 +17,7 @@
#include "mojo/edk/system/message_pipe_dispatcher.h"
#include "mojo/edk/system/message_pipe_endpoint.h"
#include "mojo/edk/system/proxy_message_pipe_endpoint.h"
+#include "mojo/edk/util/make_unique.h"
namespace mojo {
namespace system {
@@ -155,9 +157,9 @@ MojoResult MessagePipe::WriteMessage(
MutexLocker locker(&mutex_);
return EnqueueMessageNoLock(
GetPeerPort(port),
- make_scoped_ptr(new MessageInTransit(
+ util::MakeUnique<MessageInTransit>(
MessageInTransit::Type::ENDPOINT_CLIENT,
- MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA, num_bytes, bytes)),
+ MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA, num_bytes, bytes),
transports);
}
@@ -293,8 +295,8 @@ bool MessagePipe::OnReadMessage(unsigned port, MessageInTransit* message) {
// |ProxyMessagePipeEndpoint| |port| receives a message (from the |Channel|).
// We need to pass this message on to its peer port (typically a
// |LocalMessagePipeEndpoint|).
- MojoResult result = EnqueueMessageNoLock(GetPeerPort(port),
- make_scoped_ptr(message), nullptr);
+ MojoResult result = EnqueueMessageNoLock(
+ GetPeerPort(port), std::unique_ptr<MessageInTransit>(message), nullptr);
DLOG_IF(WARNING, result != MOJO_RESULT_OK)
<< "EnqueueMessageNoLock() failed (result = " << result << ")";
return true;
@@ -317,7 +319,7 @@ MessagePipe::~MessagePipe() {
MojoResult MessagePipe::EnqueueMessageNoLock(
unsigned port,
- scoped_ptr<MessageInTransit> message,
+ std::unique_ptr<MessageInTransit> message,
std::vector<DispatcherTransport>* transports) {
DCHECK(port == 0 || port == 1);
DCHECK(message);
@@ -336,7 +338,7 @@ MojoResult MessagePipe::EnqueueMessageNoLock(
}
// The endpoint's |EnqueueMessage()| may not report failure.
- endpoints_[port]->EnqueueMessage(message.Pass());
+ endpoints_[port]->EnqueueMessage(std::move(message));
return MOJO_RESULT_OK;
}
« no previous file with comments | « mojo/edk/system/message_pipe.h ('k') | mojo/edk/system/message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698