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

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

Issue 23913008: C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix use of size_t 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_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..b2af057e494043a9c984a557b1faee370f02c05d
--- /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();
+ ~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(uint32_t message_name);
+
+ private:
+ ContiguousBuffer buf_;
+};
+
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_BINDINGS_LIB_MESSAGE_BUILDER_H_

Powered by Google App Engine
This is Rietveld 408576698