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

Unified Diff: mojo/system/core.cc

Issue 502573006: Remove implicit conversions from scoped_refptr to T* in mojo/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
Index: mojo/system/core.cc
diff --git a/mojo/system/core.cc b/mojo/system/core.cc
index 62c6c3161899f6663053a300454f3c08b9c0a6d2..6516a8f9782bad835f93f4ab89be0a2effe3af62 100644
--- a/mojo/system/core.cc
+++ b/mojo/system/core.cc
@@ -231,7 +231,7 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
uint32_t num_handles,
MojoWriteMessageFlags flags) {
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
// Easy case: not sending any handles.
@@ -300,7 +300,7 @@ MojoResult Core::ReadMessage(MojoHandle message_pipe_handle,
UserPointer<uint32_t> num_handles,
MojoReadMessageFlags flags) {
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
uint32_t num_handles_value = num_handles.IsNull() ? 0 : num_handles.Get();
@@ -334,7 +334,7 @@ MojoResult Core::ReadMessage(MojoHandle message_pipe_handle,
<< " handles, but handle table full";
// Close dispatchers (outside the lock).
for (size_t i = 0; i < dispatchers.size(); i++) {
- if (dispatchers[i])
+ if (dispatchers[i].get())
dispatchers[i]->Close();
}
if (rv == MOJO_RESULT_OK)
@@ -393,7 +393,7 @@ MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle,
MojoWriteDataFlags flags) {
scoped_refptr<Dispatcher> dispatcher(
GetDispatcher(data_pipe_producer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
return dispatcher->WriteData(elements, num_bytes, flags);
@@ -405,7 +405,7 @@ MojoResult Core::BeginWriteData(MojoHandle data_pipe_producer_handle,
MojoWriteDataFlags flags) {
scoped_refptr<Dispatcher> dispatcher(
GetDispatcher(data_pipe_producer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
return dispatcher->BeginWriteData(buffer, buffer_num_bytes, flags);
@@ -415,7 +415,7 @@ MojoResult Core::EndWriteData(MojoHandle data_pipe_producer_handle,
uint32_t num_bytes_written) {
scoped_refptr<Dispatcher> dispatcher(
GetDispatcher(data_pipe_producer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
return dispatcher->EndWriteData(num_bytes_written);
@@ -427,7 +427,7 @@ MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle,
MojoReadDataFlags flags) {
scoped_refptr<Dispatcher> dispatcher(
GetDispatcher(data_pipe_consumer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
return dispatcher->ReadData(elements, num_bytes, flags);
@@ -439,7 +439,7 @@ MojoResult Core::BeginReadData(MojoHandle data_pipe_consumer_handle,
MojoReadDataFlags flags) {
scoped_refptr<Dispatcher> dispatcher(
GetDispatcher(data_pipe_consumer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
return dispatcher->BeginReadData(buffer, buffer_num_bytes, flags);
@@ -449,7 +449,7 @@ MojoResult Core::EndReadData(MojoHandle data_pipe_consumer_handle,
uint32_t num_bytes_read) {
scoped_refptr<Dispatcher> dispatcher(
GetDispatcher(data_pipe_consumer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
return dispatcher->EndReadData(num_bytes_read);
@@ -469,7 +469,7 @@ MojoResult Core::CreateSharedBuffer(
result = SharedBufferDispatcher::Create(
platform_support(), validated_options, num_bytes, &dispatcher);
if (result != MOJO_RESULT_OK) {
- DCHECK(!dispatcher);
+ DCHECK(!dispatcher.get());
return result;
}
@@ -489,7 +489,7 @@ MojoResult Core::DuplicateBufferHandle(
UserPointer<const MojoDuplicateBufferHandleOptions> options,
UserPointer<MojoHandle> new_buffer_handle) {
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
// Don't verify |options| here; that's the dispatcher's job.
@@ -516,7 +516,7 @@ MojoResult Core::MapBuffer(MojoHandle buffer_handle,
UserPointer<void*> buffer,
MojoMapBufferFlags flags) {
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
- if (!dispatcher)
+ if (!dispatcher.get())
return MOJO_RESULT_INVALID_ARGUMENT;
scoped_ptr<embedder::PlatformSharedBufferMapping> mapping;
@@ -559,7 +559,7 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
dispatchers.reserve(num_handles);
for (uint32_t i = 0; i < num_handles; i++) {
scoped_refptr<Dispatcher> dispatcher = GetDispatcher(handles[i]);
- if (!dispatcher) {
+ if (!dispatcher.get()) {
*result_index = i;
return MOJO_RESULT_INVALID_ARGUMENT;
}

Powered by Google App Engine
This is Rietveld 408576698