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

Unified Diff: mojo/system/message_pipe_dispatcher.cc

Issue 414393002: Convert verification of options structs to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: temporarily disable part of OptionsValidationTest.InvalidDeath 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/message_pipe_dispatcher.h ('k') | mojo/system/options_validation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/message_pipe_dispatcher.cc
diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
index 70f3bc32e8ac9319dc31588e274c6d3a61ad8cb8..448b0859699d749158a71934d3dbdcbc3956d50b 100644
--- a/mojo/system/message_pipe_dispatcher.cc
+++ b/mojo/system/message_pipe_dispatcher.cc
@@ -43,20 +43,24 @@ MessagePipeDispatcher::MessagePipeDispatcher(
// static
MojoResult MessagePipeDispatcher::ValidateCreateOptions(
- const MojoCreateMessagePipeOptions* in_options,
+ UserPointer<const MojoCreateMessagePipeOptions> in_options,
MojoCreateMessagePipeOptions* out_options) {
const MojoCreateMessagePipeOptionsFlags kKnownFlags =
MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE;
*out_options = kDefaultCreateOptions;
- if (!in_options)
+ if (in_options.IsNull())
return MOJO_RESULT_OK;
- MojoResult result =
- ValidateOptionsStructPointerSizeAndFlags<MojoCreateMessagePipeOptions>(
- in_options, kKnownFlags, out_options);
- if (result != MOJO_RESULT_OK)
- return result;
+ UserOptionsReader<MojoCreateMessagePipeOptions> reader(in_options);
+ if (!reader.is_valid())
+ return MOJO_RESULT_INVALID_ARGUMENT;
+
+ if (!OPTIONS_STRUCT_HAS_MEMBER(MojoCreateMessagePipeOptions, flags, reader))
+ return MOJO_RESULT_OK;
+ if ((reader.options().flags & ~kKnownFlags))
+ return MOJO_RESULT_UNIMPLEMENTED;
+ out_options->flags = reader.options().flags;
// Checks for fields beyond |flags|:
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/options_validation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698