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

Unified Diff: mojo/edk/system/message_pipe_dispatcher.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/message_pipe_dispatcher.h ('k') | mojo/edk/system/message_pipe_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/message_pipe_dispatcher.cc
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index 0292c3b1ad8310e7def5eebcebad80873419f053..3aa89c78e8b564aae9ec84aa74d6e0f5b31e2a15 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/system/message_pipe_dispatcher.h"
+#include <utility>
+
#include "base/logging.h"
#include "mojo/edk/system/configuration.h"
#include "mojo/edk/system/local_message_pipe_endpoint.h"
@@ -53,12 +55,12 @@ MojoResult MessagePipeDispatcher::ValidateCreateOptions(
return MOJO_RESULT_OK;
}
-void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe,
+void MessagePipeDispatcher::Init(RefPtr<MessagePipe>&& message_pipe,
unsigned port) {
DCHECK(message_pipe);
DCHECK(port == 0 || port == 1);
- message_pipe_ = message_pipe;
+ message_pipe_ = std::move(message_pipe);
port_ = port;
}
@@ -70,11 +72,10 @@ Dispatcher::Type MessagePipeDispatcher::GetType() const {
scoped_refptr<MessagePipeDispatcher>
MessagePipeDispatcher::CreateRemoteMessagePipe(
RefPtr<ChannelEndpoint>* channel_endpoint) {
- scoped_refptr<MessagePipe> message_pipe(
- MessagePipe::CreateLocalProxy(channel_endpoint));
+ auto message_pipe = MessagePipe::CreateLocalProxy(channel_endpoint);
scoped_refptr<MessagePipeDispatcher> dispatcher =
Create(kDefaultCreateOptions);
- dispatcher->Init(message_pipe, 0);
+ dispatcher->Init(std::move(message_pipe), 0);
return dispatcher;
}
@@ -84,7 +85,7 @@ scoped_refptr<MessagePipeDispatcher> MessagePipeDispatcher::Deserialize(
const void* source,
size_t size) {
unsigned port = kInvalidPort;
- scoped_refptr<MessagePipe> message_pipe;
+ RefPtr<MessagePipe> message_pipe;
if (!MessagePipe::Deserialize(channel, source, size, &message_pipe, &port))
return nullptr;
DCHECK(message_pipe);
@@ -92,7 +93,7 @@ scoped_refptr<MessagePipeDispatcher> MessagePipeDispatcher::Deserialize(
scoped_refptr<MessagePipeDispatcher> dispatcher =
Create(kDefaultCreateOptions);
- dispatcher->Init(message_pipe, port);
+ dispatcher->Init(std::move(message_pipe), port);
return dispatcher;
}
@@ -134,8 +135,7 @@ MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
// |kDefaultCreateOptions|. Eventually, we'll have to duplicate the options
// too.
scoped_refptr<MessagePipeDispatcher> rv = Create(kDefaultCreateOptions);
- rv->Init(message_pipe_, port_);
- message_pipe_ = nullptr;
+ rv->Init(std::move(message_pipe_), port_);
port_ = kInvalidPort;
return scoped_refptr<Dispatcher>(rv.get());
}
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.h ('k') | mojo/edk/system/message_pipe_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698