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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // the thread that creates the ChannelProxy. The filter's OnMessageReceived | 79 // the thread that creates the ChannelProxy. The filter's OnMessageReceived |
80 // method is called on the thread where the IPC::Channel is running. The | 80 // method is called on the thread where the IPC::Channel is running. The |
81 // filter may be null if the consumer is not interested in handling messages | 81 // filter may be null if the consumer is not interested in handling messages |
82 // on the background thread. Any message not handled by the filter will be | 82 // on the background thread. Any message not handled by the filter will be |
83 // dispatched to the listener. The given task runner correspond to a thread | 83 // dispatched to the listener. The given task runner correspond to a thread |
84 // on which IPC::Channel is created and used (e.g. IO thread). | 84 // on which IPC::Channel is created and used (e.g. IO thread). |
85 static scoped_ptr<ChannelProxy> Create( | 85 static scoped_ptr<ChannelProxy> Create( |
86 const IPC::ChannelHandle& channel_handle, | 86 const IPC::ChannelHandle& channel_handle, |
87 Channel::Mode mode, | 87 Channel::Mode mode, |
88 Listener* listener, | 88 Listener* listener, |
89 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); | 89 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
| 90 AttachmentBroker* broker); |
90 | 91 |
91 static scoped_ptr<ChannelProxy> Create( | 92 static scoped_ptr<ChannelProxy> Create( |
92 scoped_ptr<ChannelFactory> factory, | 93 scoped_ptr<ChannelFactory> factory, |
93 Listener* listener, | 94 Listener* listener, |
94 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); | 95 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); |
95 | 96 |
96 ~ChannelProxy() override; | 97 ~ChannelProxy() override; |
97 | 98 |
98 // Initializes the channel proxy. Only call this once to initialize a channel | 99 // Initializes the channel proxy. Only call this once to initialize a channel |
99 // proxy that was not initialized in its constructor. If create_pipe_now is | 100 // proxy that was not initialized in its constructor. If create_pipe_now is |
100 // true, the pipe is created synchronously. Otherwise it's created on the IO | 101 // true, the pipe is created synchronously. Otherwise it's created on the IO |
101 // thread. | 102 // thread. |
102 void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, | 103 void Init(const IPC::ChannelHandle& channel_handle, |
103 bool create_pipe_now); | 104 Channel::Mode mode, |
| 105 bool create_pipe_now, |
| 106 AttachmentBroker* broker); |
104 void Init(scoped_ptr<ChannelFactory> factory, bool create_pipe_now); | 107 void Init(scoped_ptr<ChannelFactory> factory, bool create_pipe_now); |
105 | 108 |
106 // Close the IPC::Channel. This operation completes asynchronously, once the | 109 // Close the IPC::Channel. This operation completes asynchronously, once the |
107 // background thread processes the command to close the channel. It is ok to | 110 // background thread processes the command to close the channel. It is ok to |
108 // call this method multiple times. Redundant calls are ignored. | 111 // call this method multiple times. Redundant calls are ignored. |
109 // | 112 // |
110 // WARNING: MessageFilter objects held by the ChannelProxy is also | 113 // WARNING: MessageFilter objects held by the ChannelProxy is also |
111 // released asynchronously, and it may in fact have its final reference | 114 // released asynchronously, and it may in fact have its final reference |
112 // released on the background thread. The caller should be careful to deal | 115 // released on the background thread. The caller should be careful to deal |
113 // with / allow for this possibility. | 116 // with / allow for this possibility. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 bool did_init_; | 290 bool did_init_; |
288 | 291 |
289 #if defined(ENABLE_IPC_FUZZER) | 292 #if defined(ENABLE_IPC_FUZZER) |
290 OutgoingMessageFilter* outgoing_message_filter_; | 293 OutgoingMessageFilter* outgoing_message_filter_; |
291 #endif | 294 #endif |
292 }; | 295 }; |
293 | 296 |
294 } // namespace IPC | 297 } // namespace IPC |
295 | 298 |
296 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 299 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
OLD | NEW |