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

Unified Diff: mojo/system/message_pipe.cc

Issue 25323003: Mojo: Optimize VerifyUserPointer(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « mojo/system/memory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/message_pipe.cc
diff --git a/mojo/system/message_pipe.cc b/mojo/system/message_pipe.cc
index 8461705e4ebae51b2b66d9c4303ea1872e2310ad..6aebeb3293d7a8ed21fc0c68c7c1783da908ee88 100644
--- a/mojo/system/message_pipe.cc
+++ b/mojo/system/message_pipe.cc
@@ -80,12 +80,12 @@ MojoResult MessagePipe::WriteMessage(
unsigned destination_port = DestinationPortFromSourcePort(port);
- if (!VerifyUserPointer(bytes, num_bytes, 1))
+ if (!VerifyUserPointer<void>(bytes, num_bytes))
return MOJO_RESULT_INVALID_ARGUMENT;
if (num_bytes > kMaxMessageNumBytes)
return MOJO_RESULT_RESOURCE_EXHAUSTED;
- if (!VerifyUserPointer(handles, num_handles, sizeof(handles[0])))
+ if (!VerifyUserPointer<MojoHandle>(handles, num_handles))
return MOJO_RESULT_INVALID_ARGUMENT;
if (num_handles > kMaxMessageNumHandles)
return MOJO_RESULT_RESOURCE_EXHAUSTED;
@@ -129,11 +129,11 @@ MojoResult MessagePipe::ReadMessage(unsigned port,
DCHECK(port == 0 || port == 1);
const size_t max_bytes = num_bytes ? *num_bytes : 0;
- if (!VerifyUserPointer(bytes, max_bytes, 1))
+ if (!VerifyUserPointer<void>(bytes, max_bytes))
return MOJO_RESULT_INVALID_ARGUMENT;
const size_t max_handles = num_handles ? *num_handles : 0;
- if (!VerifyUserPointer(handles, max_handles, sizeof(handles[0])))
+ if (!VerifyUserPointer<MojoHandle>(handles, max_handles))
return MOJO_RESULT_INVALID_ARGUMENT;
base::AutoLock locker(lock_);
« no previous file with comments | « mojo/system/memory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698