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

Unified Diff: mojo/edk/system/data_pipe_producer_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/data_pipe_producer_dispatcher.h ('k') | mojo/edk/system/dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/data_pipe_producer_dispatcher.cc
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index 5221713ddb3213808ee89ee327b7279210f978c4..cb712d39e7bfe4cfab9333cf4a92ffa7e261a2ac 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -4,6 +4,8 @@
#include "mojo/edk/system/data_pipe_producer_dispatcher.h"
+#include <utility>
+
#include "base/logging.h"
#include "mojo/edk/system/data_pipe.h"
#include "mojo/edk/system/memory.h"
@@ -11,9 +13,9 @@
namespace mojo {
namespace system {
-void DataPipeProducerDispatcher::Init(scoped_refptr<DataPipe> data_pipe) {
+void DataPipeProducerDispatcher::Init(RefPtr<DataPipe>&& data_pipe) {
DCHECK(data_pipe);
- data_pipe_ = data_pipe;
+ data_pipe_ = std::move(data_pipe);
}
Dispatcher::Type DataPipeProducerDispatcher::GetType() const {
@@ -25,13 +27,13 @@ scoped_refptr<DataPipeProducerDispatcher>
DataPipeProducerDispatcher::Deserialize(Channel* channel,
const void* source,
size_t size) {
- scoped_refptr<DataPipe> data_pipe;
+ RefPtr<DataPipe> data_pipe;
if (!DataPipe::ProducerDeserialize(channel, source, size, &data_pipe))
return nullptr;
DCHECK(data_pipe);
scoped_refptr<DataPipeProducerDispatcher> dispatcher = Create();
- dispatcher->Init(data_pipe);
+ dispatcher->Init(std::move(data_pipe));
return dispatcher;
}
@@ -64,8 +66,7 @@ DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
mutex().AssertHeld();
scoped_refptr<DataPipeProducerDispatcher> rv = Create();
- rv->Init(data_pipe_);
- data_pipe_ = nullptr;
+ rv->Init(std::move(data_pipe_));
return scoped_refptr<Dispatcher>(rv.get());
}
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.h ('k') | mojo/edk/system/dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698