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

Unified Diff: mojo/system/local_data_pipe.cc

Issue 325213004: Mojo: Wrap the satisfied/unsatisfied wait flags state in a single object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « mojo/system/local_data_pipe.h ('k') | mojo/system/local_message_pipe_endpoint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/local_data_pipe.cc
diff --git a/mojo/system/local_data_pipe.cc b/mojo/system/local_data_pipe.cc
index 942e4be81322032ca9be8a05b63be9652f4b84ba..d98ccf42ac468ea1636f254b7070d643e169fcc8 100644
--- a/mojo/system/local_data_pipe.cc
+++ b/mojo/system/local_data_pipe.cc
@@ -151,19 +151,14 @@ MojoResult LocalDataPipe::ProducerEndWriteDataImplNoLock(
return MOJO_RESULT_OK;
}
-MojoWaitFlags LocalDataPipe::ProducerSatisfiedFlagsNoLock() {
- MojoWaitFlags rv = MOJO_WAIT_FLAG_NONE;
- if (consumer_open_no_lock() &&
- (may_discard() || current_num_bytes_ < capacity_num_bytes()) &&
- !producer_in_two_phase_write_no_lock())
- rv |= MOJO_WAIT_FLAG_WRITABLE;
- return rv;
-}
-
-MojoWaitFlags LocalDataPipe::ProducerSatisfiableFlagsNoLock() {
- MojoWaitFlags rv = MOJO_WAIT_FLAG_NONE;
- if (consumer_open_no_lock())
- rv |= MOJO_WAIT_FLAG_WRITABLE;
+WaitFlagsState LocalDataPipe::ProducerGetWaitFlagsStateNoLock() const {
+ WaitFlagsState rv;
+ if (consumer_open_no_lock()) {
+ if ((may_discard() || current_num_bytes_ < capacity_num_bytes()) &&
+ !producer_in_two_phase_write_no_lock())
+ rv.satisfied_flags |= MOJO_WAIT_FLAG_WRITABLE;
+ rv.satisfiable_flags |= MOJO_WAIT_FLAG_WRITABLE;
+ }
return rv;
}
@@ -278,17 +273,15 @@ MojoResult LocalDataPipe::ConsumerEndReadDataImplNoLock(
return MOJO_RESULT_OK;
}
-MojoWaitFlags LocalDataPipe::ConsumerSatisfiedFlagsNoLock() {
- MojoWaitFlags rv = MOJO_WAIT_FLAG_NONE;
- if (current_num_bytes_ > 0 && !consumer_in_two_phase_read_no_lock())
- rv |= MOJO_WAIT_FLAG_READABLE;
- return rv;
-}
-
-MojoWaitFlags LocalDataPipe::ConsumerSatisfiableFlagsNoLock() {
- MojoWaitFlags rv = MOJO_WAIT_FLAG_NONE;
- if (current_num_bytes_ > 0 || producer_open_no_lock())
- rv |= MOJO_WAIT_FLAG_READABLE;
+WaitFlagsState LocalDataPipe::ConsumerGetWaitFlagsStateNoLock() const {
+ WaitFlagsState rv;
+ if (current_num_bytes_ > 0) {
+ if (!consumer_in_two_phase_read_no_lock())
+ rv.satisfied_flags |= MOJO_WAIT_FLAG_READABLE;
+ rv.satisfiable_flags |= MOJO_WAIT_FLAG_READABLE;
+ } else if (producer_open_no_lock()) {
+ rv.satisfiable_flags |= MOJO_WAIT_FLAG_READABLE;
+ }
return rv;
}
« no previous file with comments | « mojo/system/local_data_pipe.h ('k') | mojo/system/local_message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698