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

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

Issue 1856113002: EDK: Add implementation of data pipe consumer read threshold stuff. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 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/dispatcher_unittest.cc ('k') | mojo/edk/system/remote_data_pipe_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/local_data_pipe_impl.cc
diff --git a/mojo/edk/system/local_data_pipe_impl.cc b/mojo/edk/system/local_data_pipe_impl.cc
index 0aa0466c0e68376dc827b8974c3546b0c6d2aa26..7c05c2248eba5d23500c9ff2c66f833fc5ed92cc 100644
--- a/mojo/edk/system/local_data_pipe_impl.cc
+++ b/mojo/edk/system/local_data_pipe_impl.cc
@@ -314,16 +314,27 @@ MojoResult LocalDataPipeImpl::ConsumerEndReadData(uint32_t num_bytes_read) {
HandleSignalsState LocalDataPipeImpl::ConsumerGetHandleSignalsState() const {
HandleSignalsState rv;
- if (current_num_bytes_ > 0) {
+ // |consumer_read_threshold_num_bytes()| is always at least 1.
+ if (current_num_bytes_ >= consumer_read_threshold_num_bytes()) {
+ if (!consumer_in_two_phase_read()) {
+ rv.satisfied_signals |=
+ MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_READ_THRESHOLD;
+ }
+ rv.satisfiable_signals |=
+ MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_READ_THRESHOLD;
+ } else if (current_num_bytes_ > 0u) {
if (!consumer_in_two_phase_read())
rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_READABLE;
rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_READABLE;
- } else if (producer_open()) {
- rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_READABLE;
}
- if (!producer_open())
+ if (producer_open()) {
+ rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_READABLE |
+ MOJO_HANDLE_SIGNAL_PEER_CLOSED |
+ MOJO_HANDLE_SIGNAL_READ_THRESHOLD;
+ } else {
rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
- rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+ rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+ }
return rv;
}
« no previous file with comments | « mojo/edk/system/dispatcher_unittest.cc ('k') | mojo/edk/system/remote_data_pipe_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698