Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: ipc/ipc_channel_reader.h

Issue 1321803003: ipc: Make sure that ChannelReader is destroyed correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_add_header4
Patch Set: Rebase against top of tree. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698