Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(844)

Unified Diff: mojo/edk/system/data_pipe_consumer_dispatcher.h

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/edk/system/data_pipe_consumer_dispatcher.h
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.h b/mojo/edk/system/data_pipe_consumer_dispatcher.h
index 8239b11462f9851793790928ef693eabdd02cbac..ef4cfeaa115cfbb1e6b057b0d8b94cbf66fbdd3b 100644
--- a/mojo/edk/system/data_pipe_consumer_dispatcher.h
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.h
@@ -20,6 +20,7 @@
#include "mojo/edk/system/dispatcher.h"
#include "mojo/edk/system/ports/port_ref.h"
#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/edk/system/watcher_set.h"
namespace mojo {
namespace edk {
@@ -43,10 +44,6 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher final
// Dispatcher:
Type GetType() const override;
MojoResult Close() override;
- MojoResult Watch(MojoHandleSignals signals,
- const Watcher::WatchCallback& callback,
- uintptr_t context) override;
- MojoResult CancelWatch(uintptr_t context) override;
MojoResult ReadData(void* elements,
uint32_t* num_bytes,
MojoReadDataFlags flags) override;
@@ -55,6 +52,10 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher final
MojoReadDataFlags flags) override;
MojoResult EndReadData(uint32_t num_bytes_read) override;
HandleSignalsState GetHandleSignalsState() const override;
+ MojoResult AddWatcherRef(const scoped_refptr<WatcherDispatcher>& watcher,
+ uintptr_t context) override;
+ MojoResult RemoveWatcherRef(WatcherDispatcher* watcher,
+ uintptr_t context) override;
MojoResult AddAwakable(Awakable* awakable,
MojoHandleSignals signals,
uintptr_t context,
@@ -101,6 +102,7 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher final
mutable base::Lock lock_;
AwakableList awakable_list_;
+ WatcherSet watchers_;
scoped_refptr<PlatformSharedBuffer> shared_ring_buffer_;
std::unique_ptr<PlatformSharedBufferMapping> ring_buffer_mapping_;
@@ -117,6 +119,10 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher final
uint32_t read_offset_ = 0;
uint32_t bytes_available_ = 0;
+ // Used to temporarily suppress the readable signal until new data arrives on
+ // the pipe.
+ bool suppress_readable_signal_ = false;
+
DISALLOW_COPY_AND_ASSIGN(DataPipeConsumerDispatcher);
};

Powered by Google App Engine
This is Rietveld 408576698