| Index: mojo/system/message_pipe_dispatcher.cc
|
| diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
|
| index e0270f8b30177e32e7b86b7a2ce491715bc3ca7e..0c60f48b88170e68e7a50af65fc24f06dc8302c2 100644
|
| --- a/mojo/system/message_pipe_dispatcher.cc
|
| +++ b/mojo/system/message_pipe_dispatcher.cc
|
| @@ -12,7 +12,10 @@
|
| namespace mojo {
|
| namespace system {
|
|
|
| -MessagePipeDispatcher::MessagePipeDispatcher() {
|
| +const unsigned kInvalidPort = static_cast<unsigned>(-1);
|
| +
|
| +MessagePipeDispatcher::MessagePipeDispatcher()
|
| + : port_(kInvalidPort) {
|
| }
|
|
|
| void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe,
|
| @@ -38,6 +41,7 @@ MojoResult MessagePipeDispatcher::CloseImplNoLock() {
|
| lock().AssertAcquired();
|
| message_pipe_->Close(port_);
|
| message_pipe_ = NULL;
|
| + port_ = kInvalidPort;
|
| return MOJO_RESULT_OK;
|
| }
|
|
|
| @@ -63,8 +67,8 @@ MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
|
|
|
| MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
|
| void* bytes, uint32_t* num_bytes,
|
| - uint32_t max_num_dispatchers,
|
| std::vector<scoped_refptr<Dispatcher> >* dispatchers,
|
| + uint32_t* num_dispatchers,
|
| MojoReadMessageFlags flags) {
|
| lock().AssertAcquired();
|
|
|
| @@ -77,7 +81,7 @@ MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
|
|
|
| return message_pipe_->ReadMessage(port_,
|
| bytes, num_bytes,
|
| - max_num_dispatchers, dispatchers,
|
| + dispatchers, num_dispatchers,
|
| flags);
|
| }
|
|
|
| @@ -93,5 +97,16 @@ void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
|
| message_pipe_->RemoveWaiter(port_, waiter);
|
| }
|
|
|
| +scoped_refptr<Dispatcher>
|
| +MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
|
| + lock().AssertAcquired();
|
| +
|
| + scoped_refptr<MessagePipeDispatcher> rv = new MessagePipeDispatcher;
|
| + rv->Init(message_pipe_, port_);
|
| + message_pipe_ = NULL;
|
| + port_ = kInvalidPort;
|
| + return scoped_refptr<Dispatcher>(rv.get());
|
| +}
|
| +
|
| } // namespace system
|
| } // namespace mojo
|
|
|