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

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

Issue 2078043002: Make Dispatcher::AddAwakable(), etc. always set *signals_state (if signals_state is non-null). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | 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.cc
diff --git a/mojo/edk/system/data_pipe.cc b/mojo/edk/system/data_pipe.cc
index 7167873266e740e66894892897d7a054f6f2e730..d851be5ab79c5296afb7d9db02381eb2d858d838 100644
--- a/mojo/edk/system/data_pipe.cc
+++ b/mojo/edk/system/data_pipe.cc
@@ -406,18 +406,15 @@ MojoResult DataPipe::ProducerAddAwakable(Awakable* awakable,
DCHECK(has_local_producer_no_lock());
HandleSignalsState producer_state = impl_->ProducerGetHandleSignalsState();
+ if (signals_state)
+ *signals_state = producer_state;
if (producer_state.satisfies(signals)) {
if (force)
producer_awakable_list_->Add(awakable, signals, context);
- if (signals_state)
- *signals_state = producer_state;
return MOJO_RESULT_ALREADY_EXISTS;
}
- if (!producer_state.can_satisfy(signals)) {
- if (signals_state)
- *signals_state = producer_state;
+ if (!producer_state.can_satisfy(signals))
return MOJO_RESULT_FAILED_PRECONDITION;
- }
producer_awakable_list_->Add(awakable, signals, context);
return MOJO_RESULT_OK;
@@ -639,18 +636,15 @@ MojoResult DataPipe::ConsumerAddAwakable(Awakable* awakable,
DCHECK(has_local_consumer_no_lock());
HandleSignalsState consumer_state = impl_->ConsumerGetHandleSignalsState();
+ if (signals_state)
+ *signals_state = consumer_state;
if (consumer_state.satisfies(signals)) {
if (force)
consumer_awakable_list_->Add(awakable, signals, context);
- if (signals_state)
- *signals_state = consumer_state;
return MOJO_RESULT_ALREADY_EXISTS;
}
- if (!consumer_state.can_satisfy(signals)) {
- if (signals_state)
- *signals_state = consumer_state;
+ if (!consumer_state.can_satisfy(signals))
return MOJO_RESULT_FAILED_PRECONDITION;
- }
consumer_awakable_list_->Add(awakable, signals, context);
return MOJO_RESULT_OK;
« no previous file with comments | « no previous file | mojo/edk/system/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698