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

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

Issue 1396783004: Convert mojo::system::ChannelEndpointClient to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 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
« 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