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

Unified Diff: mojo/edk/system/channel_endpoint.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/channel_endpoint.h ('k') | mojo/edk/system/channel_endpoint_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/channel_endpoint.cc
diff --git a/mojo/edk/system/channel_endpoint.cc b/mojo/edk/system/channel_endpoint.cc
index e7e17b4bb3d7fd0e495f2de8b24f8bf8faa6afa4..73f3c7a9dc0563e5f20cf3b453dab3df59b06468 100644
--- a/mojo/edk/system/channel_endpoint.cc
+++ b/mojo/edk/system/channel_endpoint.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/system/channel_endpoint.h"
+#include <utility>
+
#include "base/logging.h"
#include "base/threading/platform_thread.h"
#include "mojo/edk/system/channel.h"
@@ -26,17 +28,18 @@ ChannelEndpoint::ChannelEndpoint(ChannelEndpointClient* client,
channel_message_queue_.Swap(message_queue);
}
-bool ChannelEndpoint::EnqueueMessage(scoped_ptr<MessageInTransit> message) {
+bool ChannelEndpoint::EnqueueMessage(
+ std::unique_ptr<MessageInTransit> message) {
DCHECK(message);
MutexLocker locker(&mutex_);
switch (state_) {
case State::PAUSED:
- channel_message_queue_.AddMessage(message.Pass());
+ channel_message_queue_.AddMessage(std::move(message));
return true;
case State::RUNNING:
- return WriteMessageNoLock(message.Pass());
+ return WriteMessageNoLock(std::move(message));
case State::DEAD:
return false;
}
@@ -96,9 +99,9 @@ void ChannelEndpoint::AttachAndRun(Channel* channel,
}
}
-void ChannelEndpoint::OnReadMessage(scoped_ptr<MessageInTransit> message) {
+void ChannelEndpoint::OnReadMessage(std::unique_ptr<MessageInTransit> message) {
if (message->type() == MessageInTransit::Type::ENDPOINT_CLIENT) {
- OnReadMessageForClient(message.Pass());
+ OnReadMessageForClient(std::move(message));
return;
}
@@ -148,7 +151,8 @@ ChannelEndpoint::~ChannelEndpoint() {
DCHECK(!remote_id_.is_valid());
}
-bool ChannelEndpoint::WriteMessageNoLock(scoped_ptr<MessageInTransit> message) {
+bool ChannelEndpoint::WriteMessageNoLock(
+ std::unique_ptr<MessageInTransit> message) {
DCHECK(message);
mutex_.AssertHeld();
@@ -160,11 +164,11 @@ bool ChannelEndpoint::WriteMessageNoLock(scoped_ptr<MessageInTransit> message) {
message->SerializeAndCloseDispatchers(channel_);
message->set_source_id(local_id_);
message->set_destination_id(remote_id_);
- return channel_->WriteMessage(message.Pass());
+ return channel_->WriteMessage(std::move(message));
}
void ChannelEndpoint::OnReadMessageForClient(
- scoped_ptr<MessageInTransit> message) {
+ std::unique_ptr<MessageInTransit> message) {
DCHECK_EQ(message->type(), MessageInTransit::Type::ENDPOINT_CLIENT);
scoped_refptr<ChannelEndpointClient> client;
« no previous file with comments | « mojo/edk/system/channel_endpoint.h ('k') | mojo/edk/system/channel_endpoint_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698