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

Side by Side Diff: mojo/public/cpp/bindings/message.h

Issue 2114523002: Move more Mojo bindings helpers out of internal namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@group-controller
Patch Set: rebase Created 4 years, 5 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <limits> 11 #include <limits>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "mojo/public/cpp/bindings/lib/message_buffer.h" 17 #include "mojo/public/cpp/bindings/lib/message_buffer.h"
18 #include "mojo/public/cpp/bindings/lib/message_internal.h" 18 #include "mojo/public/cpp/bindings/lib/message_internal.h"
19 #include "mojo/public/cpp/system/message.h" 19 #include "mojo/public/cpp/system/message.h"
20 20
21 namespace mojo { 21 namespace mojo {
22 22
23 // Message is a holder for the data and handles to be sent over a MessagePipe. 23 // Message is a holder for the data and handles to be sent over a MessagePipe.
24 // Message owns its data and handles, but a consumer of Message is free to 24 // Message owns its data and handles, but a consumer of Message is free to
25 // mutate the data and handles. The message's data is comprised of a header 25 // mutate the data and handles. The message's data is comprised of a header
26 // followed by payload. 26 // followed by payload.
27 class Message { 27 class Message {
28 public: 28 public:
29 static const uint32_t kFlagExpectsResponse = 1 << 0;
30 static const uint32_t kFlagIsResponse = 1 << 1;
31 static const uint32_t kFlagIsSync = 1 << 2;
32
29 Message(); 33 Message();
30 ~Message(); 34 ~Message();
31 35
32 // Initializes a Message with enough space for |capacity| bytes. 36 // Initializes a Message with enough space for |capacity| bytes.
33 void Initialize(size_t capacity, bool zero_initialized); 37 void Initialize(size_t capacity, bool zero_initialized);
34 38
35 // Initializes a Message from an existing Mojo MessageHandle. 39 // Initializes a Message from an existing Mojo MessageHandle.
36 void InitializeFromMojoMessage(ScopedMessageHandle message, 40 void InitializeFromMojoMessage(ScopedMessageHandle message,
37 uint32_t num_bytes, 41 uint32_t num_bytes,
38 std::vector<Handle>* handles); 42 std::vector<Handle>* handles);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // the caller should wait on the handle to become readable. Returns 191 // the caller should wait on the handle to become readable. Returns
188 // MOJO_RESULT_OK if the message was read successfully and should be 192 // MOJO_RESULT_OK if the message was read successfully and should be
189 // dispatched, otherwise returns an error code if something went wrong. 193 // dispatched, otherwise returns an error code if something went wrong.
190 // 194 //
191 // NOTE: The message hasn't been validated and may be malformed! 195 // NOTE: The message hasn't been validated and may be malformed!
192 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); 196 MojoResult ReadMessage(MessagePipeHandle handle, Message* message);
193 197
194 } // namespace mojo 198 } // namespace mojo
195 199
196 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 200 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/validation_util.cc ('k') | mojo/public/cpp/bindings/message_header_validator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698