OLD | NEW |
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 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // Access the underlying Buffer interface. | 90 // Access the underlying Buffer interface. |
91 internal::Buffer* buffer() { return buffer_.get(); } | 91 internal::Buffer* buffer() { return buffer_.get(); } |
92 | 92 |
93 private: | 93 private: |
94 void CloseHandles(); | 94 void CloseHandles(); |
95 | 95 |
96 scoped_ptr<internal::PickleBuffer> buffer_; | 96 scoped_ptr<internal::PickleBuffer> buffer_; |
97 std::vector<Handle> handles_; | 97 std::vector<Handle> handles_; |
98 | 98 |
99 MOJO_DISALLOW_COPY_AND_ASSIGN(Message); | 99 DISALLOW_COPY_AND_ASSIGN(Message); |
100 }; | 100 }; |
101 | 101 |
102 class MessageReceiver { | 102 class MessageReceiver { |
103 public: | 103 public: |
104 virtual ~MessageReceiver() {} | 104 virtual ~MessageReceiver() {} |
105 | 105 |
106 // The receiver may mutate the given message. Returns true if the message | 106 // The receiver may mutate the given message. Returns true if the message |
107 // was accepted and false otherwise, indicating that the message was invalid | 107 // was accepted and false otherwise, indicating that the message was invalid |
108 // or malformed. | 108 // or malformed. |
109 virtual bool Accept(Message* message) MOJO_WARN_UNUSED_RESULT = 0; | 109 virtual bool Accept(Message* message) MOJO_WARN_UNUSED_RESULT = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // the caller should wait on the handle to become readable. Returns | 166 // the caller should wait on the handle to become readable. Returns |
167 // MOJO_RESULT_OK if the message was read successfully and should be | 167 // MOJO_RESULT_OK if the message was read successfully and should be |
168 // dispatched, otherwise returns an error code if something went wrong. | 168 // dispatched, otherwise returns an error code if something went wrong. |
169 // | 169 // |
170 // NOTE: The message hasn't been validated and may be malformed! | 170 // NOTE: The message hasn't been validated and may be malformed! |
171 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); | 171 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); |
172 | 172 |
173 } // namespace mojo | 173 } // namespace mojo |
174 | 174 |
175 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ | 175 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ |
OLD | NEW |