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

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

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change 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.h » ('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 cb712d39e7bfe4cfab9333cf4a92ffa7e261a2ac..55ee7359631547335556049cd53972077663f598 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -23,16 +23,16 @@ Dispatcher::Type DataPipeProducerDispatcher::GetType() const {
}
// static
-scoped_refptr<DataPipeProducerDispatcher>
-DataPipeProducerDispatcher::Deserialize(Channel* channel,
- const void* source,
- size_t size) {
+RefPtr<DataPipeProducerDispatcher> DataPipeProducerDispatcher::Deserialize(
+ Channel* channel,
+ const void* source,
+ size_t size) {
RefPtr<DataPipe> data_pipe;
if (!DataPipe::ProducerDeserialize(channel, source, size, &data_pipe))
return nullptr;
DCHECK(data_pipe);
- scoped_refptr<DataPipeProducerDispatcher> dispatcher = Create();
+ auto dispatcher = DataPipeProducerDispatcher::Create();
dispatcher->Init(std::move(data_pipe));
return dispatcher;
}
@@ -61,13 +61,13 @@ void DataPipeProducerDispatcher::CloseImplNoLock() {
data_pipe_ = nullptr;
}
-scoped_refptr<Dispatcher>
+RefPtr<Dispatcher>
DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
mutex().AssertHeld();
- scoped_refptr<DataPipeProducerDispatcher> rv = Create();
- rv->Init(std::move(data_pipe_));
- return scoped_refptr<Dispatcher>(rv.get());
+ auto dispatcher = DataPipeProducerDispatcher::Create();
+ dispatcher->Init(std::move(data_pipe_));
+ return dispatcher;
}
MojoResult DataPipeProducerDispatcher::WriteDataImplNoLock(
@@ -126,7 +126,7 @@ void DataPipeProducerDispatcher::StartSerializeImplNoLock(
Channel* channel,
size_t* max_size,
size_t* max_platform_handles) {
- DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
+ AssertHasOneRef(); // Only one ref => no need to take the lock.
data_pipe_->ProducerStartSerialize(channel, max_size, max_platform_handles);
}
@@ -135,7 +135,7 @@ bool DataPipeProducerDispatcher::EndSerializeAndCloseImplNoLock(
void* destination,
size_t* actual_size,
embedder::PlatformHandleVector* platform_handles) {
- DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
+ AssertHasOneRef(); // Only one ref => no need to take the lock.
bool rv = data_pipe_->ProducerEndSerialize(channel, destination, actual_size,
platform_handles);
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.h ('k') | mojo/edk/system/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698