Index: mojo/system/dispatcher.cc |
diff --git a/mojo/system/dispatcher.cc b/mojo/system/dispatcher.cc |
index a2c51265c2b66ec696eba6b1a08b4ccce65d8856..ccb75095452e472d7d9c39b384ab1718cdd37e0b 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, |
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); |
} |
@@ -68,6 +69,16 @@ void Dispatcher::RemoveWaiter(Waiter* waiter) { |
RemoveWaiterImplNoLock(waiter); |
} |
+scoped_refptr<Dispatcher> |
+Dispatcher::CreateEquivalentDispatcherAndCloseNoLock() { |
+ lock_.AssertAcquired(); |
+ DCHECK(!is_closed_); |
+ |
+ is_closed_ = true; |
+ CancelAllWaitersNoLock(); |
+ return CreateEquivalentDispatcherAndCloseImplNoLock(); |
+} |
+ |
Dispatcher::Dispatcher() |
: is_closed_(false) { |
} |
@@ -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 |