Make Python not support "all or none" for two-phase data pipe read/write.
Note: The data pipe tests are somewhat dependent on implementation at a
lower level. E.g., there's no guarantee that after a write, all the data
written becomes available "atomically". There's also no guarantee on the
size of the read/write buffers for two-phase reads/writes -- even if a
two-phase write of a given size was done, there's no guarantee that a
corresponding two-phase read will have a buffer of the same size
available. However, I've left the tests alone for now.
BUG=#366
R=vardhan@google.com
Review URL: https://codereview.chromium.org/1364463006 .
diff --git a/mojo/public/dart/tools/fetch_dart_packages.py b/mojo/public/dart/tools/fetch_dart_packages.py
index 79d8f21..53a1c34 100755
--- a/mojo/public/dart/tools/fetch_dart_packages.py
+++ b/mojo/public/dart/tools/fetch_dart_packages.py
@@ -55,11 +55,12 @@
def main():
parser = argparse.ArgumentParser(description='Update third_party packages')
- parser.add_argument('--pub-exe',
- action='store',
- metavar='pub_exe',
- help='Path to the pub executable',
- default='../../../../third_party/dart-sdk/dart-sdk/bin/pub')
+ parser.add_argument(
+ '--pub-exe',
+ action='store',
+ metavar='pub_exe',
+ help='Path to the pub executable',
+ default='../../../../third_party/dart-sdk/dart-sdk/bin/pub')
parser.add_argument('--directory',
action='store',
metavar='directory',
diff --git a/mojo/public/python/mojo_system.pyx b/mojo/public/python/mojo_system.pyx
index e07b0e6..31ef2a4 100644
--- a/mojo/public/python/mojo_system.pyx
+++ b/mojo/public/python/mojo_system.pyx
@@ -491,8 +491,7 @@
return (res, None)
def BeginWriteData(self,
- min_size=None,
- flags=WRITE_DATA_FLAG_NONE):
+ flags=WRITE_DATA_FLAG_NONE):
"""
Begins a two-phase write to the data pipe producer.
@@ -508,9 +507,6 @@
"""
cdef void* out_buffer
cdef uint32_t out_size = 0
- if min_size:
- flags |= c_core.MOJO_WRITE_DATA_FLAG_ALL_OR_NONE
- out_size = min_size
cdef c_core.MojoResult res = c_core.MojoBeginWriteData(self._mojo_handle,
&out_buffer,
&out_size,
@@ -565,7 +561,7 @@
flags|c_core.MOJO_READ_DATA_FLAG_QUERY)
return (res, num_bytes)
- def BeginReadData(self, min_size=None, flags=READ_DATA_FLAG_NONE):
+ def BeginReadData(self, flags=READ_DATA_FLAG_NONE):
"""
Begins a two-phase read to the data pipe consumer.
@@ -581,9 +577,6 @@
"""
cdef const void* out_buffer
cdef uint32_t out_size = 0
- if min_size:
- flags |= c_core.MOJO_READ_DATA_FLAG_ALL_OR_NONE
- out_size = min_size
cdef c_core.MojoResult res = c_core.MojoBeginReadData(self._mojo_handle,
&out_buffer,
&out_size,
diff --git a/mojo/python/tests/system_unittest.py b/mojo/python/tests/system_unittest.py
index 7a3febc..b956033 100644
--- a/mojo/python/tests/system_unittest.py
+++ b/mojo/python/tests/system_unittest.py
@@ -264,7 +264,7 @@
def testTwoPhaseWriteOnDataPipe(self):
pipes = system.DataPipe()
- (res, buf) = pipes.producer_handle.BeginWriteData(DATA_SIZE)
+ (res, buf) = pipes.producer_handle.BeginWriteData()
self.assertEquals(system.RESULT_OK, res)
self.assertGreaterEqual(len(buf.buffer), DATA_SIZE)
data = _GetRandomBuffer(DATA_SIZE)