| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 std::vector<Handle>* mutable_handles() { return &handles_; } | 92 std::vector<Handle>* mutable_handles() { return &handles_; } |
| 93 | 93 |
| 94 // Access the underlying Buffer interface. | 94 // Access the underlying Buffer interface. |
| 95 internal::Buffer* buffer() { return buffer_.get(); } | 95 internal::Buffer* buffer() { return buffer_.get(); } |
| 96 | 96 |
| 97 // Takes a scoped MessageHandle which may be passed to |WriteMessageNew()| for | 97 // Takes a scoped MessageHandle which may be passed to |WriteMessageNew()| for |
| 98 // transmission. Note that this invalidates this Message object, taking | 98 // transmission. Note that this invalidates this Message object, taking |
| 99 // ownership of its internal storage and any attached handles. | 99 // ownership of its internal storage and any attached handles. |
| 100 ScopedMessageHandle TakeMojoMessage(); | 100 ScopedMessageHandle TakeMojoMessage(); |
| 101 | 101 |
| 102 // Notifies the system that this message is "bad," in this case meaning it was |
| 103 // rejected by bindings validation code. |
| 104 void NotifyBadMessage(); |
| 105 |
| 102 private: | 106 private: |
| 103 void CloseHandles(); | 107 void CloseHandles(); |
| 104 | 108 |
| 105 std::unique_ptr<internal::MessageBuffer> buffer_; | 109 std::unique_ptr<internal::MessageBuffer> buffer_; |
| 106 std::vector<Handle> handles_; | 110 std::vector<Handle> handles_; |
| 107 | 111 |
| 108 DISALLOW_COPY_AND_ASSIGN(Message); | 112 DISALLOW_COPY_AND_ASSIGN(Message); |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 class MessageReceiver { | 115 class MessageReceiver { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // the caller should wait on the handle to become readable. Returns | 186 // the caller should wait on the handle to become readable. Returns |
| 183 // MOJO_RESULT_OK if the message was read successfully and should be | 187 // MOJO_RESULT_OK if the message was read successfully and should be |
| 184 // dispatched, otherwise returns an error code if something went wrong. | 188 // dispatched, otherwise returns an error code if something went wrong. |
| 185 // | 189 // |
| 186 // NOTE: The message hasn't been validated and may be malformed! | 190 // NOTE: The message hasn't been validated and may be malformed! |
| 187 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); | 191 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); |
| 188 | 192 |
| 189 } // namespace mojo | 193 } // namespace mojo |
| 190 | 194 |
| 191 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ | 195 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ |
| OLD | NEW |