Index: mojo/edk/system/core.cc |
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc |
index 27d33b26db94a85b32993de05d751b055764b65b..3843d9714a7702c36e2290e382976eaf0c08388b 100644 |
--- a/mojo/edk/system/core.cc |
+++ b/mojo/edk/system/core.cc |
@@ -47,10 +47,11 @@ namespace system { |
// |Dispatcher|s for the handles that it wants to wait on with a |Waiter| |
// object; this |Waiter| object may be created on the stack of that thread or be |
// kept in thread local storage for that thread (TODO(vtl): future improvement). |
-// The |Dispatcher| then adds the |Waiter| to a |WaiterList| that's either owned |
-// by that |Dispatcher| (see |SimpleDispatcher|) or by a secondary object (e.g., |
-// |MessagePipe|). To signal/wake a |Waiter|, the object in question -- either a |
-// |SimpleDispatcher| or a secondary object -- talks to its |WaiterList|. |
+// The |Dispatcher| then adds the |Waiter| to an |AwakableList| that's either |
+// owned by that |Dispatcher| (see |SimpleDispatcher|) or by a secondary object |
+// (e.g., |MessagePipe|). To signal/wake a |Waiter|, the object in question -- |
+// either a |SimpleDispatcher| or a secondary object -- talks to its |
+// |AwakableList|. |
// Thread-safety notes |
// |
@@ -221,7 +222,7 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle, |
uint32_t num_handles, |
MojoWriteMessageFlags flags) { |
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
// Easy case: not sending any handles. |
@@ -288,7 +289,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.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
uint32_t num_handles_value = num_handles.IsNull() ? 0 : num_handles.Get(); |
@@ -322,7 +323,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].get()) |
+ if (dispatchers[i]) |
dispatchers[i]->Close(); |
} |
if (rv == MOJO_RESULT_OK) |
@@ -381,7 +382,7 @@ MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, |
MojoWriteDataFlags flags) { |
scoped_refptr<Dispatcher> dispatcher( |
GetDispatcher(data_pipe_producer_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
return dispatcher->WriteData(elements, num_bytes, flags); |
@@ -393,7 +394,7 @@ MojoResult Core::BeginWriteData(MojoHandle data_pipe_producer_handle, |
MojoWriteDataFlags flags) { |
scoped_refptr<Dispatcher> dispatcher( |
GetDispatcher(data_pipe_producer_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
return dispatcher->BeginWriteData(buffer, buffer_num_bytes, flags); |
@@ -403,7 +404,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.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
return dispatcher->EndWriteData(num_bytes_written); |
@@ -415,7 +416,7 @@ MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle, |
MojoReadDataFlags flags) { |
scoped_refptr<Dispatcher> dispatcher( |
GetDispatcher(data_pipe_consumer_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
return dispatcher->ReadData(elements, num_bytes, flags); |
@@ -427,7 +428,7 @@ MojoResult Core::BeginReadData(MojoHandle data_pipe_consumer_handle, |
MojoReadDataFlags flags) { |
scoped_refptr<Dispatcher> dispatcher( |
GetDispatcher(data_pipe_consumer_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
return dispatcher->BeginReadData(buffer, buffer_num_bytes, flags); |
@@ -437,7 +438,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.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
return dispatcher->EndReadData(num_bytes_read); |
@@ -457,7 +458,7 @@ MojoResult Core::CreateSharedBuffer( |
result = SharedBufferDispatcher::Create(platform_support(), validated_options, |
num_bytes, &dispatcher); |
if (result != MOJO_RESULT_OK) { |
- DCHECK(!dispatcher.get()); |
+ DCHECK(!dispatcher); |
return result; |
} |
@@ -477,7 +478,7 @@ MojoResult Core::DuplicateBufferHandle( |
UserPointer<const MojoDuplicateBufferHandleOptions> options, |
UserPointer<MojoHandle> new_buffer_handle) { |
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
// Don't verify |options| here; that's the dispatcher's job. |
@@ -504,7 +505,7 @@ MojoResult Core::MapBuffer(MojoHandle buffer_handle, |
UserPointer<void*> buffer, |
MojoMapBufferFlags flags) { |
scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle)); |
- if (!dispatcher.get()) |
+ if (!dispatcher) |
return MOJO_RESULT_INVALID_ARGUMENT; |
scoped_ptr<embedder::PlatformSharedBufferMapping> mapping; |
@@ -532,7 +533,7 @@ MojoResult Core::UnmapBuffer(UserPointer<void> buffer) { |
// Note: We allow |handles| to repeat the same handle multiple times, since |
// different flags may be specified. |
-// TODO(vtl): This incurs a performance cost in |RemoveWaiter()|. Analyze this |
+// TODO(vtl): This incurs a performance cost in |Remove()|. Analyze this |
// more carefully and address it if necessary. |
MojoResult Core::WaitManyInternal(const MojoHandle* handles, |
const MojoHandleSignals* signals, |
@@ -547,7 +548,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.get()) { |
+ if (!dispatcher) { |
*result_index = i; |
return MOJO_RESULT_INVALID_ARGUMENT; |
} |
@@ -561,7 +562,7 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles, |
uint32_t i; |
MojoResult rv = MOJO_RESULT_OK; |
for (i = 0; i < num_handles; i++) { |
- rv = dispatchers[i]->AddWaiter( |
+ rv = dispatchers[i]->AddAwakable( |
&waiter, signals[i], i, signals_states ? &signals_states[i] : nullptr); |
if (rv != MOJO_RESULT_OK) { |
*result_index = i; |
@@ -579,8 +580,8 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles, |
// |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be |
// destroyed, but this would still be required if the waiter were in TLS.) |
for (i = 0; i < num_added; i++) { |
- dispatchers[i]->RemoveWaiter(&waiter, |
- signals_states ? &signals_states[i] : nullptr); |
+ dispatchers[i]->RemoveAwakable( |
+ &waiter, signals_states ? &signals_states[i] : nullptr); |
} |
if (signals_states) { |
for (; i < num_handles; i++) |