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_PROXY_H_ | 5 #ifndef IPC_IPC_CHANNEL_PROXY_H_ |
6 #define IPC_IPC_CHANNEL_PROXY_H_ | 6 #define IPC_IPC_CHANNEL_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 }; | 109 }; |
110 | 110 |
111 | 111 |
112 // Interface for a filter to be imposed on outgoing messages which can | 112 // Interface for a filter to be imposed on outgoing messages which can |
113 // re-write the message. Used mainly for testing. | 113 // re-write the message. Used mainly for testing. |
114 class OutgoingMessageFilter { | 114 class OutgoingMessageFilter { |
115 public: | 115 public: |
116 // Returns a re-written message, freeing the original, or simply the | 116 // Returns a re-written message, freeing the original, or simply the |
117 // original unchanged if no rewrite indicated. | 117 // original unchanged if no rewrite indicated. |
118 virtual Message *Rewrite(Message *message) = 0; | 118 virtual Message *Rewrite(Message *message) = 0; |
| 119 |
| 120 protected: |
| 121 virtual ~OutgoingMessageFilter() { } |
119 }; | 122 }; |
120 | 123 |
121 // Initializes a channel proxy. The channel_handle and mode parameters are | 124 // Initializes a channel proxy. The channel_handle and mode parameters are |
122 // passed directly to the underlying IPC::Channel. The listener is called on | 125 // passed directly to the underlying IPC::Channel. The listener is called on |
123 // the thread that creates the ChannelProxy. The filter's OnMessageReceived | 126 // the thread that creates the ChannelProxy. The filter's OnMessageReceived |
124 // method is called on the thread where the IPC::Channel is running. The | 127 // method is called on the thread where the IPC::Channel is running. The |
125 // filter may be null if the consumer is not interested in handling messages | 128 // filter may be null if the consumer is not interested in handling messages |
126 // on the background thread. Any message not handled by the filter will be | 129 // on the background thread. Any message not handled by the filter will be |
127 // dispatched to the listener. The given task runner correspond to a thread | 130 // dispatched to the listener. The given task runner correspond to a thread |
128 // on which IPC::Channel is created and used (e.g. IO thread). | 131 // on which IPC::Channel is created and used (e.g. IO thread). |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 287 |
285 OutgoingMessageFilter* outgoing_message_filter_; | 288 OutgoingMessageFilter* outgoing_message_filter_; |
286 | 289 |
287 // Whether the channel has been initialized. | 290 // Whether the channel has been initialized. |
288 bool did_init_; | 291 bool did_init_; |
289 }; | 292 }; |
290 | 293 |
291 } // namespace IPC | 294 } // namespace IPC |
292 | 295 |
293 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 296 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
OLD | NEW |