Remove support for "all or none" two-phase data pipe read/write.
(Will clean up/simplify the rest of mojo/edk/system separately.)
BUG=#366
R=jamesr@chromium.org, rogulenko@google.com
Review URL: https://codereview.chromium.org/1374463002 .
diff --git a/mojo/edk/system/core_unittest.cc b/mojo/edk/system/core_unittest.cc
index 0ef0aa1..57495d8 100644
--- a/mojo/edk/system/core_unittest.cc
+++ b/mojo/edk/system/core_unittest.cc
@@ -997,12 +997,12 @@
MakeUserPointer(&num_bytes),
MOJO_READ_DATA_FLAG_PEEK));
- // Read the remaining two characters, in two-phase mode (all-or-none).
+ // Read the remaining two characters, in two-phase mode.
num_bytes = 2;
ASSERT_EQ(MOJO_RESULT_OK,
core()->BeginReadData(ch, MakeUserPointer(&read_ptr),
MakeUserPointer(&num_bytes),
- MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+ MOJO_READ_DATA_FLAG_NONE));
// Note: Count on still being able to do the contiguous read here.
ASSERT_EQ(2u, num_bytes);
@@ -1236,7 +1236,7 @@
ASSERT_EQ(MOJO_RESULT_OK,
core()->BeginReadData(ch, MakeUserPointer(&read_ptr),
MakeUserPointer(&num_bytes),
- MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+ MOJO_READ_DATA_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_BUSY,
core()->WriteMessage(h_passing[0], UserPointer<const void>(kHello),
kHelloSize, MakeUserPointer(&ch), 1,
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
index 5a1bafb..0821c64 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -107,12 +107,13 @@
mutex().AssertHeld();
// These flags may not be used in two-phase mode.
- if ((flags & MOJO_READ_DATA_FLAG_DISCARD) ||
+ if ((flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE) ||
+ (flags & MOJO_READ_DATA_FLAG_DISCARD) ||
(flags & MOJO_READ_DATA_FLAG_QUERY) || (flags & MOJO_READ_DATA_FLAG_PEEK))
return MOJO_RESULT_INVALID_ARGUMENT;
- return data_pipe_->ConsumerBeginReadData(
- buffer, buffer_num_bytes, (flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+ // TODO(vtl): Remove all-or-none support at lower levels.
+ return data_pipe_->ConsumerBeginReadData(buffer, buffer_num_bytes, false);
}
MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock(
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
index ddb8b9f..536dace 100644
--- a/mojo/edk/system/data_pipe_producer_dispatcher.cc
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -84,8 +84,12 @@
MojoWriteDataFlags flags) {
mutex().AssertHeld();
- return data_pipe_->ProducerBeginWriteData(
- buffer, buffer_num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
+ // This flag may not be used in two-phase mode.
+ if ((flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE))
+ return MOJO_RESULT_INVALID_ARGUMENT;
+
+ // TODO(vtl): Remove all-or-none support at lower levels.
+ return data_pipe_->ProducerBeginWriteData(buffer, buffer_num_bytes, false);
}
MojoResult DataPipeProducerDispatcher::EndWriteDataImplNoLock(