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

Unified Diff: mojo/system/message_in_transit.h

Issue 173333002: Mojo: Make MessageInTransit more opaque still. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | mojo/system/message_in_transit.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/message_in_transit.h
diff --git a/mojo/system/message_in_transit.h b/mojo/system/message_in_transit.h
index ecc480840696830918a1204d29b22d5b3f3a77f0..10229e8451b9b8e5be05f29cf51e4039a07d9ac7 100644
--- a/mojo/system/message_in_transit.h
+++ b/mojo/system/message_in_transit.h
@@ -53,6 +53,28 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit {
// Destroys a |MessageInTransit| created using |Create()| or |Clone()|.
void Destroy();
+ // Gets the size of the next message from |buffer|, which has |buffer_size|
+ // bytes currently available, returning true and setting |*next_message_size|
+ // on success. |buffer| should be aligned on a |kMessageAlignment| boundary
+ // (and on success, |*next_message_size| will be a multiple of
+ // |kMessageAlignment|).
+ // TODO(vtl): In |RawChannelPosix|, the alignment requirements are currently
+ // satisified on a faith-based basis.
+ static bool GetNextMessageSize(const void* buffer,
+ size_t buffer_size,
+ size_t* next_message_size);
+
+ // Creates a read-only |MessageInTransit| from |buffer|, which must have
+ // enough data (as indicated by |GetNextMessageSize()|). |buffer| has the same
+ // alignment requirements as in |GetNextMessageSize()|.
+ //
+ // The returned message should not be destroyed using |Destroy()|, and the
+ // underlying buffer must remain alive and unmodified as long as the returned
+ // message is in use.
+ // TODO(vtl): Change these odd semantics (once I make |MessageInTransit|s have
+ // pointers to the buffers, instead of being POD).
+ static const MessageInTransit* CreateReadOnlyFromBuffer(const void* buffer);
+
// Gets the "main" buffer for a |MessageInTransit|. A |MessageInTransit| can
// be serialized by writing the main buffer. The returned pointer will be
// aligned to a multiple of |kMessageAlignment| bytes, and the size of the
« no previous file with comments | « no previous file | mojo/system/message_in_transit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698