Chromium Code Reviews| Index: mojo/public/bindings/lib/message_builder.h |
| diff --git a/mojo/public/bindings/lib/message_builder.h b/mojo/public/bindings/lib/message_builder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..49ece956d1e0506dbac548f243b3cf1c91cb1ee8 |
| --- /dev/null |
| +++ b/mojo/public/bindings/lib/message_builder.h |
| @@ -0,0 +1,34 @@ |
| +// 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_BUILDER_H_ |
| +#define MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_BUILDER_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include "mojo/public/bindings/lib/buffer.h" |
| + |
| +namespace mojo { |
| +struct MessageData; |
| + |
| +// Used to construct a MessageData object. |
| +class MessageBuilder { |
| + public: |
| + MessageBuilder(uint32_t message_name, size_t payload_size); |
| + ~MessageBuilder(); |
| + |
| + Buffer* buffer() { return &buf_; } |
| + |
| + // Call Finish when done making allocations in |buffer()|. A heap-allocated |
| + // MessageData object will be returned. When no longer needed, use |free()| |
| + // to release the MessageData object's memory. |
| + MessageData* Finish(); |
| + |
| + private: |
| + FixedBuffer buf_; |
|
dmichael (off chromium)
2013/10/14 22:41:19
nit: MOJO_DISALLOW_COPY_AND_ASSIGN?
(just for sel
|
| +}; |
| + |
| +} // namespace mojo |
| + |
| +#endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_BUILDER_H_ |