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_FORWARDING_MESSAGE_FILTER_H_ | 5 #ifndef IPC_IPC_FORWARDING_MESSAGE_FILTER_H_ |
6 #define IPC_IPC_FORWARDING_MESSAGE_FILTER_H_ | 6 #define IPC_IPC_FORWARDING_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 ForwardingMessageFilter( | 38 ForwardingMessageFilter( |
39 const uint32* message_ids_to_filter, | 39 const uint32* message_ids_to_filter, |
40 size_t num_message_ids_to_filter, | 40 size_t num_message_ids_to_filter, |
41 base::TaskRunner* target_task_runner); | 41 base::TaskRunner* target_task_runner); |
42 | 42 |
43 // Define the message routes to be filtered. | 43 // Define the message routes to be filtered. |
44 void AddRoute(int routing_id, const Handler& handler); | 44 void AddRoute(int routing_id, const Handler& handler); |
45 void RemoveRoute(int routing_id); | 45 void RemoveRoute(int routing_id); |
46 | 46 |
47 // MessageFilter methods: | 47 // MessageFilter methods: |
48 bool OnMessageReceived(const Message& message) override; | 48 virtual bool OnMessageReceived(const Message& message) override; |
49 | 49 |
50 private: | 50 private: |
51 ~ForwardingMessageFilter() override; | 51 virtual ~ForwardingMessageFilter(); |
52 | 52 |
53 std::set<int> message_ids_to_filter_; | 53 std::set<int> message_ids_to_filter_; |
54 | 54 |
55 // The handler_ only gets Run on the thread corresponding to | 55 // The handler_ only gets Run on the thread corresponding to |
56 // target_task_runner_. | 56 // target_task_runner_. |
57 scoped_refptr<base::TaskRunner> target_task_runner_; | 57 scoped_refptr<base::TaskRunner> target_task_runner_; |
58 | 58 |
59 // Protects access to routes_. | 59 // Protects access to routes_. |
60 base::Lock handlers_lock_; | 60 base::Lock handlers_lock_; |
61 | 61 |
62 // Indicates the routing_ids for which messages should be filtered. | 62 // Indicates the routing_ids for which messages should be filtered. |
63 std::map<int, Handler> handlers_; | 63 std::map<int, Handler> handlers_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(ForwardingMessageFilter); | 65 DISALLOW_COPY_AND_ASSIGN(ForwardingMessageFilter); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace IPC | 68 } // namespace IPC |
69 | 69 |
70 #endif // IPC_IPC_FORWARDING_MESSAGE_FILTER_H_ | 70 #endif // IPC_IPC_FORWARDING_MESSAGE_FILTER_H_ |
OLD | NEW |