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

Unified Diff: mojo/system/data_pipe.cc

Issue 416203002: Convert BeginReadData...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 5 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/system/data_pipe.h ('k') | mojo/system/data_pipe_consumer_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/data_pipe.cc
diff --git a/mojo/system/data_pipe.cc b/mojo/system/data_pipe.cc
index 02b49be8343184663858b5c3029af5f6a5ae00cd..687b96837f108495ab1bc5e29961022128e7a460 100644
--- a/mojo/system/data_pipe.cc
+++ b/mojo/system/data_pipe.cc
@@ -286,20 +286,25 @@ MojoResult DataPipe::ConsumerQueryData(uint32_t* num_bytes) {
return ConsumerQueryDataImplNoLock(num_bytes);
}
-MojoResult DataPipe::ConsumerBeginReadData(const void** buffer,
- uint32_t* buffer_num_bytes,
- bool all_or_none) {
+MojoResult DataPipe::ConsumerBeginReadData(
+ UserPointer<const void*> buffer,
+ UserPointer<uint32_t> buffer_num_bytes,
+ bool all_or_none) {
base::AutoLock locker(lock_);
DCHECK(has_local_consumer_no_lock());
if (consumer_in_two_phase_read_no_lock())
return MOJO_RESULT_BUSY;
- if (all_or_none && *buffer_num_bytes % element_num_bytes_ != 0)
- return MOJO_RESULT_INVALID_ARGUMENT;
+ uint32_t min_num_bytes_to_read = 0;
+ if (all_or_none) {
+ min_num_bytes_to_read = buffer_num_bytes.Get();
+ if (min_num_bytes_to_read % element_num_bytes_ != 0)
+ return MOJO_RESULT_INVALID_ARGUMENT;
+ }
MojoResult rv = ConsumerBeginReadDataImplNoLock(buffer, buffer_num_bytes,
- all_or_none);
+ min_num_bytes_to_read);
if (rv != MOJO_RESULT_OK)
return rv;
DCHECK(consumer_in_two_phase_read_no_lock());
« no previous file with comments | « mojo/system/data_pipe.h ('k') | mojo/system/data_pipe_consumer_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698