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

Side by Side Diff: mojo/public/bindings/lib/message_builder.cc

Issue 27034003: Mojo C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation issue on Official Linux builder 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/public/bindings/lib/message_builder.h"
6
7 #include "mojo/public/bindings/lib/message.h"
8
9 namespace mojo {
10
11 MessageBuilder::MessageBuilder(uint32_t message_name, size_t payload_size)
12 : buf_(sizeof(MessageHeader) + payload_size) {
13 MessageHeader* header =
14 static_cast<MessageHeader*>(buf_.Allocate(sizeof(MessageHeader)));
15 header->num_bytes = static_cast<uint32_t>(buf_.size());
16 header->name = message_name;
17 }
18
19 MessageBuilder::~MessageBuilder() {
20 }
21
22 MessageData* MessageBuilder::Finish() {
23 return static_cast<MessageData*>(buf_.Leak());
24 }
25
26 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698