Chromium Code Reviews| 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 |
|
dmichael (off chromium)
2013/10/14 22:41:19
"the its"->"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 |
|
dmichael (off chromium)
2013/10/14 22:41:19
s/regains/retains?
s/should be/is?
|
| + // data member. |
| + virtual bool Accept(Message* message) = 0; |
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_H_ |