Index: mojo/edk/system/data_pipe_consumer_dispatcher.cc |
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc |
index 1f6f07947736428784dfba2cba1cc6ea58eed517..269f8b21c0ade15c3c44add6a45dd64d9f81e17e 100644 |
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.cc |
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc |
@@ -21,6 +21,7 @@ |
#include "mojo/edk/system/data_pipe_control_message.h" |
#include "mojo/edk/system/node_controller.h" |
#include "mojo/edk/system/ports_message.h" |
+#include "mojo/edk/system/request_context.h" |
#include "mojo/public/c/system/data_pipe.h" |
namespace mojo { |
@@ -86,6 +87,29 @@ MojoResult DataPipeConsumerDispatcher::Close() { |
return CloseNoLock(); |
} |
+ |
+MojoResult DataPipeConsumerDispatcher::Watch( |
+ MojoHandleSignals signals, |
+ const Watcher::WatchCallback& callback, |
+ uintptr_t context) { |
+ base::AutoLock lock(lock_); |
+ |
+ if (is_closed_ || in_transit_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return awakable_list_.AddWatcher( |
+ signals, callback, context, GetHandleSignalsStateNoLock()); |
+} |
+ |
+MojoResult DataPipeConsumerDispatcher::CancelWatch(uintptr_t context) { |
+ base::AutoLock lock(lock_); |
+ |
+ if (is_closed_ || in_transit_) |
+ return MOJO_RESULT_INVALID_ARGUMENT; |
+ |
+ return awakable_list_.RemoveWatcher(context); |
+} |
+ |
MojoResult DataPipeConsumerDispatcher::ReadData(void* elements, |
uint32_t* num_bytes, |
MojoReadDataFlags flags) { |
@@ -474,6 +498,8 @@ void DataPipeConsumerDispatcher::OnPortStatusChanged() { |
} |
void DataPipeConsumerDispatcher::UpdateSignalsStateNoLock() { |
+ RequestContext request_context; |
+ |
lock_.AssertAcquired(); |
bool was_peer_closed = peer_closed_; |