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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "ipc/attachment_broker.h" |
9 #include "ipc/ipc_channel.h" | 10 #include "ipc/ipc_channel.h" |
10 #include "ipc/ipc_export.h" | 11 #include "ipc/ipc_export.h" |
11 | 12 |
12 namespace IPC { | 13 namespace IPC { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 // This class provides common pipe reading functionality for the | 16 // This class provides common pipe reading functionality for the |
16 // platform-specific IPC channel implementations. | 17 // platform-specific IPC channel implementations. |
17 // | 18 // |
18 // It does the common input buffer management and message dispatch, while the | 19 // It does the common input buffer management and message dispatch, while the |
19 // platform-specific parts provide the pipe management through a virtual | 20 // platform-specific parts provide the pipe management through a virtual |
20 // interface implemented on a per-platform basis. | 21 // interface implemented on a per-platform basis. |
21 // | 22 // |
22 // Note that there is no "writer" corresponding to this because the code for | 23 // Note that there is no "writer" corresponding to this because the code for |
23 // writing to the channel is much simpler and has very little common | 24 // writing to the channel is much simpler and has very little common |
24 // functionality that would benefit from being factored out. If we add | 25 // functionality that would benefit from being factored out. If we add |
25 // something like that in the future, it would be more appropriate to add it | 26 // something like that in the future, it would be more appropriate to add it |
26 // here (and rename appropriately) rather than writing a different class. | 27 // here (and rename appropriately) rather than writing a different class. |
27 class ChannelReader { | 28 class ChannelReader : virtual public SupportsAttachmentBrokering { |
28 public: | 29 public: |
29 explicit ChannelReader(Listener* listener); | 30 explicit ChannelReader(Listener* listener); |
30 virtual ~ChannelReader(); | 31 virtual ~ChannelReader(); |
31 | 32 |
32 void set_listener(Listener* listener) { listener_ = listener; } | 33 void set_listener(Listener* listener) { listener_ = listener; } |
33 | 34 |
34 // Call to process messages received from the IPC connection and dispatch | 35 // Call to process messages received from the IPC connection and dispatch |
35 // them. Returns false on channel error. True indicates that everything | 36 // them. Returns false on channel error. True indicates that everything |
36 // succeeded, although there may not have been any messages processed. | 37 // succeeded, although there may not have been any messages processed. |
37 bool ProcessIncomingMessages(); | 38 bool ProcessIncomingMessages(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // this buffer. | 102 // this buffer. |
102 std::string input_overflow_buf_; | 103 std::string input_overflow_buf_; |
103 | 104 |
104 DISALLOW_COPY_AND_ASSIGN(ChannelReader); | 105 DISALLOW_COPY_AND_ASSIGN(ChannelReader); |
105 }; | 106 }; |
106 | 107 |
107 } // namespace internal | 108 } // namespace internal |
108 } // namespace IPC | 109 } // namespace IPC |
109 | 110 |
110 #endif // IPC_IPC_CHANNEL_READER_H_ | 111 #endif // IPC_IPC_CHANNEL_READER_H_ |
OLD | NEW |