OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // An IPC::ChannelProxy can have a MessageFilter associated with it, which will | 40 // An IPC::ChannelProxy can have a MessageFilter associated with it, which will |
41 // be notified of incoming messages on the IPC::Channel's thread. This gives | 41 // be notified of incoming messages on the IPC::Channel's thread. This gives |
42 // the consumer of IPC::ChannelProxy the ability to respond to incoming | 42 // the consumer of IPC::ChannelProxy the ability to respond to incoming |
43 // messages on this background thread instead of on their own thread, which may | 43 // messages on this background thread instead of on their own thread, which may |
44 // be bogged down with other processing. The result can be greatly improved | 44 // be bogged down with other processing. The result can be greatly improved |
45 // latency for messages that can be handled on a background thread. | 45 // latency for messages that can be handled on a background thread. |
46 // | 46 // |
47 // The consumer of IPC::ChannelProxy is responsible for allocating the Thread | 47 // The consumer of IPC::ChannelProxy is responsible for allocating the Thread |
48 // instance where the IPC::Channel will be created and operated. | 48 // instance where the IPC::Channel will be created and operated. |
49 // | 49 // |
50 class ChannelProxy : public Message::Sender { | 50 class IPC_EXPORT ChannelProxy : public Message::Sender { |
51 public: | 51 public: |
52 | 52 |
53 struct MessageFilterTraits; | 53 struct MessageFilterTraits; |
54 | 54 |
55 // A class that receives messages on the thread where the IPC channel is | 55 // A class that receives messages on the thread where the IPC channel is |
56 // running. It can choose to prevent the default action for an IPC message. | 56 // running. It can choose to prevent the default action for an IPC message. |
57 class MessageFilter | 57 class IPC_EXPORT MessageFilter |
58 : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> { | 58 : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> { |
59 public: | 59 public: |
60 MessageFilter(); | 60 MessageFilter(); |
61 virtual ~MessageFilter(); | 61 virtual ~MessageFilter(); |
62 | 62 |
63 // Called on the background thread to provide the filter with access to the | 63 // Called on the background thread to provide the filter with access to the |
64 // channel. Called when the IPC channel is initialized or when AddFilter | 64 // channel. Called when the IPC channel is initialized or when AddFilter |
65 // is called if the channel is already initialized. | 65 // is called if the channel is already initialized. |
66 virtual void OnFilterAdded(Channel* channel); | 66 virtual void OnFilterAdded(Channel* channel); |
67 | 67 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // can safely be destroyed while the background thread continues to do stuff | 263 // can safely be destroyed while the background thread continues to do stuff |
264 // that involves this data. | 264 // that involves this data. |
265 scoped_refptr<Context> context_; | 265 scoped_refptr<Context> context_; |
266 | 266 |
267 OutgoingMessageFilter* outgoing_message_filter_; | 267 OutgoingMessageFilter* outgoing_message_filter_; |
268 }; | 268 }; |
269 | 269 |
270 } // namespace IPC | 270 } // namespace IPC |
271 | 271 |
272 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 272 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
OLD | NEW |