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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Used internally to hold state that is referenced on the IPC thread. | 243 // Used internally to hold state that is referenced on the IPC thread. |
244 class Context : public base::RefCountedThreadSafe<Context>, | 244 class Context : public base::RefCountedThreadSafe<Context>, |
245 public Listener { | 245 public Listener { |
246 public: | 246 public: |
247 Context(Listener* listener, | 247 Context(Listener* listener, |
248 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_thread); | 248 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_thread); |
249 void ClearIPCTaskRunner(); | 249 void ClearIPCTaskRunner(); |
250 base::SingleThreadTaskRunner* ipc_task_runner() const { | 250 base::SingleThreadTaskRunner* ipc_task_runner() const { |
251 return ipc_task_runner_.get(); | 251 return ipc_task_runner_.get(); |
252 } | 252 } |
253 const std::string& channel_id() const { return channel_id_; } | |
254 | |
255 // Dispatches a message on the listener thread. | 253 // Dispatches a message on the listener thread. |
256 void OnDispatchMessage(const Message& message); | 254 void OnDispatchMessage(const Message& message); |
257 | 255 |
258 // Sends |message| from appropriate thread. | 256 // Sends |message| from appropriate thread. |
259 void Send(Message* message); | 257 void Send(Message* message); |
260 | 258 |
261 // Requests a remote associated interface on the IPC thread. | 259 // Requests a remote associated interface on the IPC thread. |
262 void GetRemoteAssociatedInterface( | 260 void GetRemoteAssociatedInterface( |
263 const std::string& name, | 261 const std::string& name, |
264 mojo::ScopedInterfaceEndpointHandle handle); | 262 mojo::ScopedInterfaceEndpointHandle handle); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 330 |
333 // List of filters. This is only accessed on the IPC thread. | 331 // List of filters. This is only accessed on the IPC thread. |
334 std::vector<scoped_refptr<MessageFilter> > filters_; | 332 std::vector<scoped_refptr<MessageFilter> > filters_; |
335 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; | 333 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; |
336 | 334 |
337 // Note, channel_ may be set on the Listener thread or the IPC thread. | 335 // Note, channel_ may be set on the Listener thread or the IPC thread. |
338 // But once it has been set, it must only be read or cleared on the IPC | 336 // But once it has been set, it must only be read or cleared on the IPC |
339 // thread. | 337 // thread. |
340 // One exception is the thread-safe send. See the class comment. | 338 // One exception is the thread-safe send. See the class comment. |
341 std::unique_ptr<Channel> channel_; | 339 std::unique_ptr<Channel> channel_; |
342 std::string channel_id_; | |
343 bool channel_connected_called_; | 340 bool channel_connected_called_; |
344 | 341 |
345 // Lock for |channel_| value. This is only relevant in the context of | 342 // Lock for |channel_| value. This is only relevant in the context of |
346 // thread-safe send. | 343 // thread-safe send. |
347 base::Lock channel_lifetime_lock_; | 344 base::Lock channel_lifetime_lock_; |
348 | 345 |
349 // Routes a given message to a proper subset of |filters_|, depending | 346 // Routes a given message to a proper subset of |filters_|, depending |
350 // on which message classes a filter might support. | 347 // on which message classes a filter might support. |
351 std::unique_ptr<MessageFilterRouter> message_filter_router_; | 348 std::unique_ptr<MessageFilterRouter> message_filter_router_; |
352 | 349 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 bool did_init_; | 403 bool did_init_; |
407 | 404 |
408 #if defined(ENABLE_IPC_FUZZER) | 405 #if defined(ENABLE_IPC_FUZZER) |
409 OutgoingMessageFilter* outgoing_message_filter_; | 406 OutgoingMessageFilter* outgoing_message_filter_; |
410 #endif | 407 #endif |
411 }; | 408 }; |
412 | 409 |
413 } // namespace IPC | 410 } // namespace IPC |
414 | 411 |
415 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 412 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
OLD | NEW |