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 | |
82 // Populates the given buffer with data from the pipe. | 78 // Populates the given buffer with data from the pipe. |
83 // | 79 // |
84 // Returns the state of the read. On READ_SUCCESS, the number of bytes | 80 // Returns the state of the read. On READ_SUCCESS, the number of bytes |
85 // read will be placed into |*bytes_read| (which can be less than the | 81 // read will be placed into |*bytes_read| (which can be less than the |
86 // buffer size). On READ_FAILED, the channel will be closed. | 82 // buffer size). On READ_FAILED, the channel will be closed. |
87 // | 83 // |
88 // If the return value is READ_PENDING, it means that there was no data | 84 // If the return value is READ_PENDING, it means that there was no data |
89 // ready for reading. The implementation is then responsible for either | 85 // ready for reading. The implementation is then responsible for either |
90 // calling AsyncReadComplete with the number of bytes read into the | 86 // calling AsyncReadComplete with the number of bytes read into the |
91 // buffer, or ProcessIncomingMessages to try the read again (depending | 87 // buffer, or ProcessIncomingMessages to try the read again (depending |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // set contains the AttachmentIds that are needed to unblock the message. | 171 // set contains the AttachmentIds that are needed to unblock the message. |
176 AttachmentIdSet blocked_ids_; | 172 AttachmentIdSet blocked_ids_; |
177 | 173 |
178 DISALLOW_COPY_AND_ASSIGN(ChannelReader); | 174 DISALLOW_COPY_AND_ASSIGN(ChannelReader); |
179 }; | 175 }; |
180 | 176 |
181 } // namespace internal | 177 } // namespace internal |
182 } // namespace IPC | 178 } // namespace IPC |
183 | 179 |
184 #endif // IPC_IPC_CHANNEL_READER_H_ | 180 #endif // IPC_IPC_CHANNEL_READER_H_ |
OLD | NEW |