OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // the thread that creates the ChannelProxy. The filter's OnMessageReceived | 86 // the thread that creates the ChannelProxy. The filter's OnMessageReceived |
87 // method is called on the thread where the IPC::Channel is running. The | 87 // method is called on the thread where the IPC::Channel is running. The |
88 // filter may be null if the consumer is not interested in handling messages | 88 // filter may be null if the consumer is not interested in handling messages |
89 // on the background thread. Any message not handled by the filter will be | 89 // on the background thread. Any message not handled by the filter will be |
90 // dispatched to the listener. The given message loop indicates where the | 90 // dispatched to the listener. The given message loop indicates where the |
91 // IPC::Channel should be created. | 91 // IPC::Channel should be created. |
92 ChannelProxy(const std::string& channel_id, Channel::Mode mode, | 92 ChannelProxy(const std::string& channel_id, Channel::Mode mode, |
93 Channel::Listener* listener, MessageFilter* filter, | 93 Channel::Listener* listener, MessageFilter* filter, |
94 MessageLoop* ipc_thread_loop); | 94 MessageLoop* ipc_thread_loop); |
95 | 95 |
96 ~ChannelProxy() { | 96 virtual ~ChannelProxy() { |
97 Close(); | 97 Close(); |
98 } | 98 } |
99 | 99 |
100 // Close the IPC::Channel. This operation completes asynchronously, once the | 100 // Close the IPC::Channel. This operation completes asynchronously, once the |
101 // background thread processes the command to close the channel. It is ok to | 101 // background thread processes the command to close the channel. It is ok to |
102 // call this method multiple times. Redundant calls are ignored. | 102 // call this method multiple times. Redundant calls are ignored. |
103 // | 103 // |
104 // WARNING: The MessageFilter object held by the ChannelProxy is also | 104 // WARNING: The MessageFilter object held by the ChannelProxy is also |
105 // released asynchronously, and it may in fact have its final reference | 105 // released asynchronously, and it may in fact have its final reference |
106 // released on the background thread. The caller should be careful to deal | 106 // released on the background thread. The caller should be careful to deal |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // By maintaining this indirection (ref-counted) to our internal state, we | 210 // By maintaining this indirection (ref-counted) to our internal state, we |
211 // can safely be destroyed while the background thread continues to do stuff | 211 // can safely be destroyed while the background thread continues to do stuff |
212 // that involves this data. | 212 // that involves this data. |
213 scoped_refptr<Context> context_; | 213 scoped_refptr<Context> context_; |
214 }; | 214 }; |
215 | 215 |
216 } // namespace IPC | 216 } // namespace IPC |
217 | 217 |
218 #endif // IPC_IPC_CHANNEL_PROXY_H__ | 218 #endif // IPC_IPC_CHANNEL_PROXY_H__ |
OLD | NEW |