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

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

Issue 2341633005: Mojo: Fix data pipe ALL_OR_NONE write capacity check. (Closed)
Patch Set: Created 4 years, 3 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/data_pipe_unittest.cc » ('j') | mojo/edk/system/data_pipe_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/data_pipe_producer_dispatcher.cc
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index 5c7b75df76665e439a1d528136c593ce100d4578..8273c14d18fc144adf2255568922ffd1f0413565 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -137,9 +137,8 @@ MojoResult DataPipeProducerDispatcher::WriteData(const void* elements,
if (*num_bytes == 0)
return MOJO_RESULT_OK; // Nothing to do.
- bool all_or_none = flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE;
- uint32_t min_num_bytes_to_write = all_or_none ? *num_bytes : 0;
- if (min_num_bytes_to_write > options_.capacity_num_bytes) {
+ if ((flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE) &&
+ (*num_bytes > available_capacity_)) {
// Don't return "should wait" since you can't wait for a specified amount of
// data.
return MOJO_RESULT_OUT_OF_RANGE;
miu 2016/09/14 22:40:23 Should this instead be: 1. MOJO_RESULT_SHOULD_WAI
jam 2016/09/15 17:08:34 the canonical documentation is in https://cs.chrom
« no previous file with comments | « no previous file | mojo/edk/system/data_pipe_unittest.cc » ('j') | mojo/edk/system/data_pipe_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698