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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/non_thread_safe.h" |
13 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
14 #include "ipc/ipc_channel_handle.h" | 15 #include "ipc/ipc_channel_handle.h" |
15 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_sender.h" | 17 #include "ipc/ipc_sender.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
20 } | 21 } |
21 | 22 |
22 namespace IPC { | 23 namespace IPC { |
(...skipping 21 matching lines...) Expand all Loading... |
44 // An IPC::ChannelProxy can have a MessageFilter associated with it, which will | 45 // An IPC::ChannelProxy can have a MessageFilter associated with it, which will |
45 // be notified of incoming messages on the IPC::Channel's thread. This gives | 46 // be notified of incoming messages on the IPC::Channel's thread. This gives |
46 // the consumer of IPC::ChannelProxy the ability to respond to incoming | 47 // the consumer of IPC::ChannelProxy the ability to respond to incoming |
47 // messages on this background thread instead of on their own thread, which may | 48 // messages on this background thread instead of on their own thread, which may |
48 // be bogged down with other processing. The result can be greatly improved | 49 // be bogged down with other processing. The result can be greatly improved |
49 // latency for messages that can be handled on a background thread. | 50 // latency for messages that can be handled on a background thread. |
50 // | 51 // |
51 // The consumer of IPC::ChannelProxy is responsible for allocating the Thread | 52 // The consumer of IPC::ChannelProxy is responsible for allocating the Thread |
52 // instance where the IPC::Channel will be created and operated. | 53 // instance where the IPC::Channel will be created and operated. |
53 // | 54 // |
54 class IPC_EXPORT ChannelProxy : public Sender { | 55 class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe { |
55 public: | 56 public: |
56 struct MessageFilterTraits; | 57 struct MessageFilterTraits; |
57 | 58 |
58 // A class that receives messages on the thread where the IPC channel is | 59 // A class that receives messages on the thread where the IPC channel is |
59 // running. It can choose to prevent the default action for an IPC message. | 60 // running. It can choose to prevent the default action for an IPC message. |
60 class IPC_EXPORT MessageFilter | 61 class IPC_EXPORT MessageFilter |
61 : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> { | 62 : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> { |
62 public: | 63 public: |
63 MessageFilter(); | 64 MessageFilter(); |
64 | 65 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 284 |
284 OutgoingMessageFilter* outgoing_message_filter_; | 285 OutgoingMessageFilter* outgoing_message_filter_; |
285 | 286 |
286 // Whether the channel has been initialized. | 287 // Whether the channel has been initialized. |
287 bool did_init_; | 288 bool did_init_; |
288 }; | 289 }; |
289 | 290 |
290 } // namespace IPC | 291 } // namespace IPC |
291 | 292 |
292 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 293 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
OLD | NEW |