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

Unified Diff: third_party/mojo/src/mojo/edk/system/data_pipe_impl.h

Issue 975973002: Update mojo sdk to rev f68e697e389943cd9bf9652397312280e96b127a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shake fist at msvc Created 5 years, 10 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: third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
diff --git a/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h b/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
index e1339c00cebc1425fb3ee790c77080a72ab00ca5..20ca900044e145fb2a8ec2869351d376399f07fa 100644
--- a/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
+++ b/third_party/mojo/src/mojo/edk/system/data_pipe_impl.h
@@ -7,18 +7,21 @@
#include <stdint.h>
+#include "base/compiler_specific.h"
#include "base/macros.h"
#include "mojo/edk/embedder/platform_handle_vector.h"
#include "mojo/edk/system/data_pipe.h"
#include "mojo/edk/system/handle_signals_state.h"
#include "mojo/edk/system/memory.h"
#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/types.h"
namespace mojo {
namespace system {
class Channel;
+class MessageInTransit;
// Base class/interface for classes that "implement" |DataPipe| for various
// situations (local versus remote). The methods, other than the constructor,
@@ -81,12 +84,26 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeImpl {
size_t* actual_size,
embedder::PlatformHandleVector* platform_handles) = 0;
+ virtual bool OnReadMessage(unsigned port, MessageInTransit* message) = 0;
+ virtual void OnDetachFromChannel(unsigned port) = 0;
+
protected:
DataPipeImpl() : owner_() {}
+ // Helper to convert the given circular buffer into messages. The input is a
+ // circular buffer |buffer| (with appropriate element size and capacity), with
+ // current contents starting at |start_index| of length |current_num_bytes|.
+ // This will convert all of the contents.
+ void ConvertDataToMessages(const char* buffer,
+ size_t* start_index,
+ size_t* current_num_bytes,
+ MessageInTransitQueue* message_queue);
+
DataPipe* owner() const { return owner_; }
- bool may_discard() const { return owner_->may_discard(); }
+ const MojoCreateDataPipeOptions& validated_options() const {
+ return owner_->validated_options();
+ }
size_t element_num_bytes() const { return owner_->element_num_bytes(); }
size_t capacity_num_bytes() const { return owner_->capacity_num_bytes(); }
bool producer_open() const { return owner_->producer_open_no_lock(); }
@@ -116,6 +133,29 @@ class MOJO_SYSTEM_IMPL_EXPORT DataPipeImpl {
DISALLOW_COPY_AND_ASSIGN(DataPipeImpl);
};
+// TODO(vtl): This is not the ideal place for the following structs; find
+// somewhere better.
+
+// Serialized form of a producer dispatcher. This will actually be followed by a
+// serialized |ChannelEndpoint|; we want to preserve alignment guarantees.
+struct ALIGNAS(8) SerializedDataPipeProducerDispatcher {
+ // Only validated (and thus canonicalized) options should be serialized.
+ // However, the deserializer must revalidate (as with everything received).
+ MojoCreateDataPipeOptions validated_options;
+ // Number of bytes already enqueued to the consumer. Set to
+ // |static_cast<size_t>(-1)| if the consumer is already closed, in which case
+ // this will *not* be followed by a serialized |ChannelEndpoint|.
+ size_t consumer_num_bytes;
+};
+
+// Serialized form of a consumer dispatcher. This will actually be followed by a
+// serialized |ChannelEndpoint|; we want to preserve alignment guarantees.
+struct ALIGNAS(8) SerializedDataPipeConsumerDispatcher {
+ // Only validated (and thus canonicalized) options should be serialized.
+ // However, the deserializer must revalidate (as with everything received).
+ MojoCreateDataPipeOptions validated_options;
+};
+
} // namespace system
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698