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

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

Issue 1856113002: EDK: Add implementation of data pipe consumer read threshold stuff. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/edk/system/data_pipe.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/data_pipe.h
diff --git a/mojo/edk/system/data_pipe.h b/mojo/edk/system/data_pipe.h
index 3ac3b379e0c50101e65d79ca150b1d0a941de9f1..f559511c5a57a6209000e46eda2c1e491da481e8 100644
--- a/mojo/edk/system/data_pipe.h
+++ b/mojo/edk/system/data_pipe.h
@@ -132,6 +132,8 @@ class DataPipe final : public ChannelEndpointClient {
// corresponding names.
void ConsumerCancelAllAwakables();
void ConsumerClose();
+ MojoResult ConsumerSetOptions(uint32_t read_threshold_num_bytes);
+ void ConsumerGetOptions(uint32_t* read_threshold_num_bytes);
// This does not validate its arguments, except to check that |*num_bytes| is
// a multiple of |element_num_bytes_|.
MojoResult ConsumerReadData(UserPointer<void> elements,
@@ -195,6 +197,14 @@ class DataPipe final : public ChannelEndpointClient {
mutex_.AssertHeld();
return consumer_open_;
}
+ // Note that this returns the "real" read threshold (never zero).
+ size_t consumer_read_threshold_num_bytes_no_lock() const
+ MOJO_SHARED_LOCKS_REQUIRED(mutex_) {
+ mutex_.AssertHeld();
+ return (consumer_read_threshold_num_bytes_ > 0u)
+ ? consumer_read_threshold_num_bytes_
+ : element_num_bytes_;
+ }
uint32_t producer_two_phase_max_num_bytes_written_no_lock() const
MOJO_SHARED_LOCKS_REQUIRED(mutex_) {
mutex_.AssertHeld();
@@ -271,6 +281,8 @@ class DataPipe final : public ChannelEndpointClient {
// *Known* state of producer or consumer.
bool producer_open_ MOJO_GUARDED_BY(mutex_);
bool consumer_open_ MOJO_GUARDED_BY(mutex_);
+ // This may be zero (in which case it "means" |element_num_bytes_|).
+ uint32_t consumer_read_threshold_num_bytes_ MOJO_GUARDED_BY(mutex_);
// Non-null only if the producer or consumer, respectively, is local.
std::unique_ptr<AwakableList> producer_awakable_list_ MOJO_GUARDED_BY(mutex_);
std::unique_ptr<AwakableList> consumer_awakable_list_ MOJO_GUARDED_BY(mutex_);
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/edk/system/data_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698