| Index: mojo/system/message_pipe_dispatcher.cc
|
| diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
|
| index ab84def4d3b0ceee8bb87ca03d23a74cafb11d53..df4def127dcb777724af4a2fd0b983b7e71f6921 100644
|
| --- a/mojo/system/message_pipe_dispatcher.cc
|
| +++ b/mojo/system/message_pipe_dispatcher.cc
|
| @@ -43,7 +43,7 @@ MojoResult MessagePipeDispatcher::CloseImplNoLock() {
|
|
|
| MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
|
| const void* bytes, uint32_t num_bytes,
|
| - const MojoHandle* handles, uint32_t num_handles,
|
| + const std::vector<Dispatcher*>* dispatchers,
|
| MojoWriteMessageFlags flags) {
|
| lock().AssertAcquired();
|
|
|
| @@ -52,40 +52,38 @@ MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
|
| if (num_bytes > kMaxMessageNumBytes)
|
| return MOJO_RESULT_RESOURCE_EXHAUSTED;
|
|
|
| - if (!VerifyUserPointer<MojoHandle>(handles, num_handles))
|
| - return MOJO_RESULT_INVALID_ARGUMENT;
|
| - if (num_handles > kMaxMessageNumHandles)
|
| - return MOJO_RESULT_RESOURCE_EXHAUSTED;
|
| - if (num_handles > 0) {
|
| - // TODO(vtl): Verify each handle.
|
| + if (dispatchers) {
|
| + DCHECK_GT(dispatchers->size(), 0u);
|
| + DCHECK_LE(dispatchers->size(), kMaxMessageNumHandles);
|
| +
|
| + // TODO(vtl)
|
| NOTIMPLEMENTED();
|
| return MOJO_RESULT_UNIMPLEMENTED;
|
| }
|
|
|
| return message_pipe_->WriteMessage(port_,
|
| bytes, num_bytes,
|
| - handles, num_handles,
|
| + dispatchers,
|
| flags);
|
| }
|
|
|
| MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
|
| void* bytes, uint32_t* num_bytes,
|
| - MojoHandle* handles, uint32_t* num_handles,
|
| + uint32_t max_num_dispatchers,
|
| + std::vector<scoped_refptr<Dispatcher> >* dispatchers,
|
| MojoReadMessageFlags flags) {
|
| lock().AssertAcquired();
|
|
|
| - // TODO(vtl): I suppose we should verify |num_bytes| and |num_handles| (i.e.,
|
| - // those pointers themselves). Hmmm.
|
| -
|
| - if (num_bytes && !VerifyUserPointer<void>(bytes, *num_bytes))
|
| - return MOJO_RESULT_INVALID_ARGUMENT;
|
| -
|
| - if (num_handles && !VerifyUserPointer<MojoHandle>(handles, *num_handles))
|
| - return MOJO_RESULT_INVALID_ARGUMENT;
|
| + if (num_bytes) {
|
| + if (!VerifyUserPointer<uint32_t>(num_bytes, 1))
|
| + return MOJO_RESULT_INVALID_ARGUMENT;
|
| + if (!VerifyUserPointer<void>(bytes, *num_bytes))
|
| + return MOJO_RESULT_INVALID_ARGUMENT;
|
| + }
|
|
|
| return message_pipe_->ReadMessage(port_,
|
| bytes, num_bytes,
|
| - handles, num_handles,
|
| + max_num_dispatchers, dispatchers,
|
| flags);
|
| }
|
|
|
|
|