| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_READER_H_ | 5 #ifndef IPC_IPC_CHANNEL_READER_H_ |
| 6 #define IPC_IPC_CHANNEL_READER_H_ | 6 #define IPC_IPC_CHANNEL_READER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // Returns true if the given message is an Hello message | 69 // Returns true if the given message is an Hello message |
| 70 // sent on channel set-up. | 70 // sent on channel set-up. |
| 71 bool IsHelloMessage(const Message& m); | 71 bool IsHelloMessage(const Message& m); |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 enum ReadState { READ_SUCCEEDED, READ_FAILED, READ_PENDING }; | 74 enum ReadState { READ_SUCCEEDED, READ_FAILED, READ_PENDING }; |
| 75 | 75 |
| 76 Listener* listener() const { return listener_; } | 76 Listener* listener() const { return listener_; } |
| 77 | 77 |
| 78 // Subclasses should call this method in their destructor to give this class a |
| 79 // chance to clean up state that might be dependent on subclass members. |
| 80 void CleanUp(); |
| 81 |
| 78 // Populates the given buffer with data from the pipe. | 82 // Populates the given buffer with data from the pipe. |
| 79 // | 83 // |
| 80 // Returns the state of the read. On READ_SUCCESS, the number of bytes | 84 // Returns the state of the read. On READ_SUCCESS, the number of bytes |
| 81 // read will be placed into |*bytes_read| (which can be less than the | 85 // read will be placed into |*bytes_read| (which can be less than the |
| 82 // buffer size). On READ_FAILED, the channel will be closed. | 86 // buffer size). On READ_FAILED, the channel will be closed. |
| 83 // | 87 // |
| 84 // If the return value is READ_PENDING, it means that there was no data | 88 // If the return value is READ_PENDING, it means that there was no data |
| 85 // ready for reading. The implementation is then responsible for either | 89 // ready for reading. The implementation is then responsible for either |
| 86 // calling AsyncReadComplete with the number of bytes read into the | 90 // calling AsyncReadComplete with the number of bytes read into the |
| 87 // buffer, or ProcessIncomingMessages to try the read again (depending | 91 // buffer, or ProcessIncomingMessages to try the read again (depending |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // set contains the AttachmentIds that are needed to unblock the message. | 175 // set contains the AttachmentIds that are needed to unblock the message. |
| 172 AttachmentIdSet blocked_ids_; | 176 AttachmentIdSet blocked_ids_; |
| 173 | 177 |
| 174 DISALLOW_COPY_AND_ASSIGN(ChannelReader); | 178 DISALLOW_COPY_AND_ASSIGN(ChannelReader); |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } // namespace internal | 181 } // namespace internal |
| 178 } // namespace IPC | 182 } // namespace IPC |
| 179 | 183 |
| 180 #endif // IPC_IPC_CHANNEL_READER_H_ | 184 #endif // IPC_IPC_CHANNEL_READER_H_ |
| OLD | NEW |