Chromium Code Reviews| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 | 129 |
| 130 // A MessageReceiver that is also able to provide status about the state | 130 // A MessageReceiver that is also able to provide status about the state |
| 131 // of the underlying MessagePipe to which it will be forwarding messages | 131 // of the underlying MessagePipe to which it will be forwarding messages |
| 132 // received via the |Accept()| call. | 132 // received via the |Accept()| call. |
| 133 class MessageReceiverWithStatus : public MessageReceiver { | 133 class MessageReceiverWithStatus : public MessageReceiver { |
| 134 public: | 134 public: |
| 135 ~MessageReceiverWithStatus() override {} | 135 ~MessageReceiverWithStatus() override {} |
| 136 | 136 |
| 137 // Returns |true| if this MessageReceiver is currently bound to a MessagePipe, | 137 // Returns |true| if this MessageReceiver is currently bound to a MessagePipe, |
| 138 // the pipe has not been closed, and the pipe has not encountered an error. | 138 // the pipe has not been closed, and the pipe has not encountered an error. |
| 139 virtual bool IsValid() = 0; | 139 virtual bool IsValid() = 0; |
|
yzshen1
2016/03/18 23:47:04
Is this method still needed?
Anand Mistry (off Chromium)
2016/03/19 01:02:13
Yes... for unittests. I'll leave it in for now and
| |
| 140 | |
| 141 // DCHECKs if this MessageReceiver is currently bound to a MessagePipe, the | |
| 142 // pipe has not been closed, and the pipe has not encountered an error. | |
|
yzshen1
2016/03/18 23:47:04
Could you please comment that this may be called f
Anand Mistry (off Chromium)
2016/03/19 01:02:13
Done.
| |
| 143 virtual void DCheckValid(const std::string& message) {} | |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 // An alternative to MessageReceiverWithResponder for cases in which it | 146 // An alternative to MessageReceiverWithResponder for cases in which it |
| 143 // is necessary for the implementor of this interface to know about the status | 147 // is necessary for the implementor of this interface to know about the status |
| 144 // of the MessagePipe which will carry the responses. | 148 // of the MessagePipe which will carry the responses. |
| 145 class MessageReceiverWithResponderStatus : public MessageReceiver { | 149 class MessageReceiverWithResponderStatus : public MessageReceiver { |
| 146 public: | 150 public: |
| 147 ~MessageReceiverWithResponderStatus() override {} | 151 ~MessageReceiverWithResponderStatus() override {} |
| 148 | 152 |
| 149 // A variant on Accept that registers a MessageReceiverWithStatus (known as | 153 // A variant on Accept that registers a MessageReceiverWithStatus (known as |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 166 // the caller should wait on the handle to become readable. Returns | 170 // the caller should wait on the handle to become readable. Returns |
| 167 // MOJO_RESULT_OK if the message was read successfully and should be | 171 // MOJO_RESULT_OK if the message was read successfully and should be |
| 168 // dispatched, otherwise returns an error code if something went wrong. | 172 // dispatched, otherwise returns an error code if something went wrong. |
| 169 // | 173 // |
| 170 // NOTE: The message hasn't been validated and may be malformed! | 174 // NOTE: The message hasn't been validated and may be malformed! |
| 171 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); | 175 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); |
| 172 | 176 |
| 173 } // namespace mojo | 177 } // namespace mojo |
| 174 | 178 |
| 175 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ | 179 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ |
| OLD | NEW |