Index: mojo/edk/system/channel_endpoint.cc |
diff --git a/mojo/edk/system/channel_endpoint.cc b/mojo/edk/system/channel_endpoint.cc |
index 70b803496eddbe360d9c6283e6fe6cce7adf1da0..b2ced62cf521ba0d919eb5c889e8dbb3f58af748 100644 |
--- a/mojo/edk/system/channel_endpoint.cc |
+++ b/mojo/edk/system/channel_endpoint.cc |
@@ -35,14 +35,14 @@ bool ChannelEndpoint::EnqueueMessage( |
return false; |
} |
-bool ChannelEndpoint::ReplaceClient(ChannelEndpointClient* client, |
+bool ChannelEndpoint::ReplaceClient(RefPtr<ChannelEndpointClient>&& client, |
unsigned client_port) { |
DCHECK(client); |
MutexLocker locker(&mutex_); |
DCHECK(client_); |
- DCHECK(client != client_.get() || client_port != client_port_); |
- client_ = client; |
+ DCHECK(client != client_ || client_port != client_port_); |
+ client_ = std::move(client); |
client_port_ = client_port; |
return state_ != State::DEAD; |
} |
@@ -102,7 +102,7 @@ void ChannelEndpoint::OnReadMessage(std::unique_ptr<MessageInTransit> message) { |
} |
void ChannelEndpoint::DetachFromChannel() { |
- scoped_refptr<ChannelEndpointClient> client; |
+ RefPtr<ChannelEndpointClient> client; |
unsigned client_port = 0; |
{ |
MutexLocker locker(&mutex_); |
@@ -131,11 +131,11 @@ void ChannelEndpoint::DetachFromChannel() { |
client->OnDetachFromChannel(client_port); |
} |
-ChannelEndpoint::ChannelEndpoint(ChannelEndpointClient* client, |
+ChannelEndpoint::ChannelEndpoint(RefPtr<ChannelEndpointClient>&& client, |
unsigned client_port, |
MessageInTransitQueue* message_queue) |
: state_(State::PAUSED), |
- client_(client), |
+ client_(std::move(client)), |
client_port_(client_port), |
channel_(nullptr) { |
DCHECK(client_ || message_queue); |
@@ -171,7 +171,7 @@ void ChannelEndpoint::OnReadMessageForClient( |
std::unique_ptr<MessageInTransit> message) { |
DCHECK_EQ(message->type(), MessageInTransit::Type::ENDPOINT_CLIENT); |
- scoped_refptr<ChannelEndpointClient> client; |
+ RefPtr<ChannelEndpointClient> client; |
unsigned client_port = 0; |
// This loop is to make |ReplaceClient()| work. We can't call the client's |