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

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

Issue 1885663002: EDK: Add implementation of data pipe producer write 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/local_data_pipe_impl.cc ('k') | mojo/public/c/system/tests/core_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/remote_consumer_data_pipe_impl.cc
diff --git a/mojo/edk/system/remote_consumer_data_pipe_impl.cc b/mojo/edk/system/remote_consumer_data_pipe_impl.cc
index 2e03bfcc61f9d6c961309959ff3ab7bb8f0b8b1a..bd991623365fa06da67f3939c3f91f46c536bb04 100644
--- a/mojo/edk/system/remote_consumer_data_pipe_impl.cc
+++ b/mojo/edk/system/remote_consumer_data_pipe_impl.cc
@@ -257,10 +257,18 @@ HandleSignalsState RemoteConsumerDataPipeImpl::ProducerGetHandleSignalsState()
const {
HandleSignalsState rv;
if (consumer_open()) {
- if (consumer_num_bytes_ < capacity_num_bytes() &&
- !producer_in_two_phase_write())
- rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_WRITABLE;
- rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_WRITABLE;
+ if (!producer_in_two_phase_write()) {
+ // |producer_write_threshold_num_bytes()| is always at least 1.
+ if (capacity_num_bytes() - consumer_num_bytes_ >=
+ producer_write_threshold_num_bytes()) {
+ rv.satisfied_signals |=
+ MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_WRITE_THRESHOLD;
+ } else if (consumer_num_bytes_ < capacity_num_bytes()) {
+ rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_WRITABLE;
+ }
+ }
+ rv.satisfiable_signals |=
+ MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_WRITE_THRESHOLD;
} else {
rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
}
« no previous file with comments | « mojo/edk/system/local_data_pipe_impl.cc ('k') | mojo/public/c/system/tests/core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698