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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // call this method multiple times. Redundant calls are ignored. | 91 // call this method multiple times. Redundant calls are ignored. |
92 // | 92 // |
93 // WARNING: MessageFilter objects held by the ChannelProxy is also | 93 // WARNING: MessageFilter objects held by the ChannelProxy is also |
94 // released asynchronously, and it may in fact have its final reference | 94 // released asynchronously, and it may in fact have its final reference |
95 // released on the background thread. The caller should be careful to deal | 95 // released on the background thread. The caller should be careful to deal |
96 // with / allow for this possibility. | 96 // with / allow for this possibility. |
97 void Close(); | 97 void Close(); |
98 | 98 |
99 // Send a message asynchronously. The message is routed to the background | 99 // Send a message asynchronously. The message is routed to the background |
100 // thread where it is passed to the IPC::Channel's Send method. | 100 // thread where it is passed to the IPC::Channel's Send method. |
101 virtual bool Send(Message* message) OVERRIDE; | 101 virtual bool Send(Message* message) override; |
102 | 102 |
103 // Used to intercept messages as they are received on the background thread. | 103 // Used to intercept messages as they are received on the background thread. |
104 // | 104 // |
105 // Ordinarily, messages sent to the ChannelProxy are routed to the matching | 105 // Ordinarily, messages sent to the ChannelProxy are routed to the matching |
106 // listener on the worker thread. This API allows code to intercept messages | 106 // listener on the worker thread. This API allows code to intercept messages |
107 // before they are sent to the worker thread. | 107 // before they are sent to the worker thread. |
108 // If you call this before the target process is launched, then you're | 108 // If you call this before the target process is launched, then you're |
109 // guaranteed to not miss any messages. But if you call this anytime after, | 109 // guaranteed to not miss any messages. But if you call this anytime after, |
110 // then some messages might be missed since the filter is added internally on | 110 // then some messages might be missed since the filter is added internally on |
111 // the IO thread. | 111 // the IO thread. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 const std::string& channel_id() const { return channel_id_; } | 148 const std::string& channel_id() const { return channel_id_; } |
149 | 149 |
150 // Dispatches a message on the listener thread. | 150 // Dispatches a message on the listener thread. |
151 void OnDispatchMessage(const Message& message); | 151 void OnDispatchMessage(const Message& message); |
152 | 152 |
153 protected: | 153 protected: |
154 friend class base::RefCountedThreadSafe<Context>; | 154 friend class base::RefCountedThreadSafe<Context>; |
155 virtual ~Context(); | 155 virtual ~Context(); |
156 | 156 |
157 // IPC::Listener methods: | 157 // IPC::Listener methods: |
158 virtual bool OnMessageReceived(const Message& message) OVERRIDE; | 158 virtual bool OnMessageReceived(const Message& message) override; |
159 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 159 virtual void OnChannelConnected(int32 peer_pid) override; |
160 virtual void OnChannelError() OVERRIDE; | 160 virtual void OnChannelError() override; |
161 | 161 |
162 // Like OnMessageReceived but doesn't try the filters. | 162 // Like OnMessageReceived but doesn't try the filters. |
163 bool OnMessageReceivedNoFilter(const Message& message); | 163 bool OnMessageReceivedNoFilter(const Message& message); |
164 | 164 |
165 // Gives the filters a chance at processing |message|. | 165 // Gives the filters a chance at processing |message|. |
166 // Returns true if the message was processed, false otherwise. | 166 // Returns true if the message was processed, false otherwise. |
167 bool TryFilters(const Message& message); | 167 bool TryFilters(const Message& message); |
168 | 168 |
169 // Like Open and Close, but called on the IPC thread. | 169 // Like Open and Close, but called on the IPC thread. |
170 virtual void OnChannelOpened(); | 170 virtual void OnChannelOpened(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // that involves this data. | 232 // that involves this data. |
233 scoped_refptr<Context> context_; | 233 scoped_refptr<Context> context_; |
234 | 234 |
235 // Whether the channel has been initialized. | 235 // Whether the channel has been initialized. |
236 bool did_init_; | 236 bool did_init_; |
237 }; | 237 }; |
238 | 238 |
239 } // namespace IPC | 239 } // namespace IPC |
240 | 240 |
241 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 241 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
OLD | NEW |