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

Unified Diff: mojo/public/bindings/lib/message.h

Issue 23913008: C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 7 years, 2 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/public/bindings/lib/message.h
diff --git a/mojo/public/bindings/lib/message.h b/mojo/public/bindings/lib/message.h
new file mode 100644
index 0000000000000000000000000000000000000000..d29ce798238e270c17bdc4e61d10e1d6c68f9178
--- /dev/null
+++ b/mojo/public/bindings/lib/message.h
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_H_
+#define MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_H_
+
+#include <vector>
+
+#include "mojo/public/system/core.h"
+
+namespace mojo {
+
+struct MessageHeader {
+ uint32_t num_bytes;
+ uint32_t name;
+};
+
+struct MessageData {
+ MessageHeader header;
+ uint8_t payload[1];
+};
+
+struct Message {
+ Message();
+ ~Message();
+
+ MessageData* data; // Heap-allocated.
+ std::vector<Handle> handles;
+};
+
+class MessageReceiver {
+ public:
+ // The receiver may mutate the given message or take ownership of the its
+ // contents. Upon return, if message->data is non-null, then the caller
+ // regains ownership of the Message and should be responsible for freeing its
+ // data member.
+ virtual bool Accept(Message* message) = 0;
+};
+
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_H_

Powered by Google App Engine
This is Rietveld 408576698