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

Side by Side Diff: mojo/public/cpp/bindings/lib/message_builder.h

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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
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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
7
8 #include <stdint.h>
9
10 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
11 #include "mojo/public/cpp/bindings/lib/message_internal.h"
12
13 namespace mojo {
14 class Message;
15
16 namespace internal {
17
18 class MessageBuilder {
19 public:
20 MessageBuilder(uint32_t name, size_t payload_size);
21 ~MessageBuilder();
22
23 Buffer* buffer() { return &buf_; }
24
25 // Call Finish when done making allocations in |buffer()|. Upon return,
26 // |message| will contain the message data, and |buffer()| will no longer be
27 // valid to reference.
28 void Finish(Message* message);
29
30 protected:
31 explicit MessageBuilder(size_t size);
32 FixedBuffer buf_;
33
34 MOJO_DISALLOW_COPY_AND_ASSIGN(MessageBuilder);
35 };
36
37 class MessageWithRequestIDBuilder : public MessageBuilder {
38 public:
39 MessageWithRequestIDBuilder(uint32_t name,
40 size_t payload_size,
41 uint32_t flags,
42 uint64_t request_id);
43 };
44
45 class RequestMessageBuilder : public MessageWithRequestIDBuilder {
46 public:
47 RequestMessageBuilder(uint32_t name, size_t payload_size)
48 : MessageWithRequestIDBuilder(name,
49 payload_size,
50 kMessageExpectsResponse,
51 0) {}
52 };
53
54 class ResponseMessageBuilder : public MessageWithRequestIDBuilder {
55 public:
56 ResponseMessageBuilder(uint32_t name,
57 size_t payload_size,
58 uint64_t request_id)
59 : MessageWithRequestIDBuilder(name,
60 payload_size,
61 kMessageIsResponse,
62 request_id) {}
63 };
64
65 } // namespace internal
66 } // namespace mojo
67
68 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_BUILDER_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/message.cc ('k') | mojo/public/cpp/bindings/lib/message_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698