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

Unified Diff: mojo/system/local_message_pipe_endpoint.cc

Issue 417303002: Convert ReadMessage...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hmm 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/local_message_pipe_endpoint.h ('k') | mojo/system/memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/local_message_pipe_endpoint.cc
diff --git a/mojo/system/local_message_pipe_endpoint.cc b/mojo/system/local_message_pipe_endpoint.cc
index 09decd3fabb79f37b25cba41bcf851e31ed52c43..3cbc712c0dfea6d206d2ec2b902342528046abef 100644
--- a/mojo/system/local_message_pipe_endpoint.cc
+++ b/mojo/system/local_message_pipe_endpoint.cc
@@ -63,15 +63,16 @@ void LocalMessagePipeEndpoint::CancelAllWaiters() {
waiter_list_.CancelAllWaiters();
}
-MojoResult LocalMessagePipeEndpoint::ReadMessage(void* bytes,
- uint32_t* num_bytes,
- DispatcherVector* dispatchers,
- uint32_t* num_dispatchers,
- MojoReadMessageFlags flags) {
+MojoResult LocalMessagePipeEndpoint::ReadMessage(
+ UserPointer<void> bytes,
+ UserPointer<uint32_t> num_bytes,
+ DispatcherVector* dispatchers,
+ uint32_t* num_dispatchers,
+ MojoReadMessageFlags flags) {
DCHECK(is_open_);
DCHECK(!dispatchers || dispatchers->empty());
- const uint32_t max_bytes = num_bytes ? *num_bytes : 0;
+ const uint32_t max_bytes = num_bytes.IsNull() ? 0 : num_bytes.Get();
const uint32_t max_num_dispatchers = num_dispatchers ? *num_dispatchers : 0;
if (message_queue_.IsEmpty()) {
@@ -83,10 +84,10 @@ MojoResult LocalMessagePipeEndpoint::ReadMessage(void* bytes,
// and release the lock immediately.
bool enough_space = true;
MessageInTransit* message = message_queue_.PeekMessage();
- if (num_bytes)
- *num_bytes = message->num_bytes();
+ if (!num_bytes.IsNull())
+ num_bytes.Put(message->num_bytes());
if (message->num_bytes() <= max_bytes)
- memcpy(bytes, message->bytes(), message->num_bytes());
+ bytes.PutArray(message->bytes(), message->num_bytes());
else
enough_space = false;
« no previous file with comments | « mojo/system/local_message_pipe_endpoint.h ('k') | mojo/system/memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698