Chromium Code Reviews| Index: mojo/system/dispatcher.cc |
| diff --git a/mojo/system/dispatcher.cc b/mojo/system/dispatcher.cc |
| index a2c51265c2b66ec696eba6b1a08b4ccce65d8856..59c8d6c5b6f0dffe7b3e6bc5a5e9507c4ea879a2 100644 |
| --- a/mojo/system/dispatcher.cc |
| +++ b/mojo/system/dispatcher.cc |
| @@ -35,17 +35,18 @@ MojoResult Dispatcher::WriteMessage(const void* bytes, uint32_t num_bytes, |
| MojoResult Dispatcher::ReadMessage( |
| void* bytes, uint32_t* num_bytes, |
| - uint32_t max_num_dispatchers, |
| std::vector<scoped_refptr<Dispatcher> >* dispatchers, |
| + uint32_t* num_dispatchers, |
|
DaveMoore
2013/11/13 02:54:02
Nit: Why do you need an output var for num_dispatc
|
| MojoReadMessageFlags flags) { |
| - DCHECK(max_num_dispatchers == 0 || (dispatchers && dispatchers->empty())); |
| + DCHECK(!num_dispatchers || *num_dispatchers == 0 || |
| + (dispatchers && dispatchers->empty())); |
| base::AutoLock locker(lock_); |
| if (is_closed_) |
| return MOJO_RESULT_INVALID_ARGUMENT; |
| return ReadMessageImplNoLock(bytes, num_bytes, |
| - max_num_dispatchers, dispatchers, |
| + dispatchers, num_dispatchers, |
| flags); |
| } |
| @@ -77,6 +78,16 @@ Dispatcher::~Dispatcher() { |
| DCHECK(is_closed_); |
| } |
| +scoped_refptr<Dispatcher> |
| +Dispatcher::CreateEquivalentDispatcherAndCloseNoLock() { |
| + lock_.AssertAcquired(); |
| + DCHECK(!is_closed_); |
| + |
| + is_closed_ = true; |
| + CancelAllWaitersNoLock(); |
| + return CreateEquivalentDispatcherAndCloseImplNoLock(); |
| +} |
| + |
| void Dispatcher::CancelAllWaitersNoLock() { |
| lock_.AssertAcquired(); |
| DCHECK(is_closed_); |
| @@ -104,10 +115,10 @@ MojoResult Dispatcher::WriteMessageImplNoLock( |
| } |
| MojoResult Dispatcher::ReadMessageImplNoLock( |
| - void* bytes, uint32_t* num_bytes, |
| - uint32_t max_num_dispatchers, |
| - std::vector<scoped_refptr<Dispatcher> >* dispatchers, |
| - MojoReadMessageFlags flags) { |
| + void* /*bytes*/, uint32_t* /*num_bytes*/, |
| + std::vector<scoped_refptr<Dispatcher> >* /*dispatchers*/, |
| + uint32_t* /*num_dispatchers*/, |
| + MojoReadMessageFlags /*flags*/) { |
| lock_.AssertAcquired(); |
| DCHECK(!is_closed_); |
| // By default, this isn't supported. Only dispatchers for message pipes (with |