OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 11 #include "ipc/ipc_message_filter.h" |
11 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
12 #include "ipc/ipc_test_base.h" | 13 #include "ipc/ipc_test_base.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 #if defined(IPC_MESSAGE_START) | 17 #if defined(IPC_MESSAGE_START) |
17 #undef IPC_MESSAGE_START | 18 #undef IPC_MESSAGE_START |
18 #endif | 19 #endif |
19 | 20 |
20 enum Command { | 21 enum Command { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 75 } |
75 | 76 |
76 channel_->Send(new IPC::Message(message)); | 77 channel_->Send(new IPC::Message(message)); |
77 return true; | 78 return true; |
78 } | 79 } |
79 | 80 |
80 private: | 81 private: |
81 IPC::Channel* channel_; | 82 IPC::Channel* channel_; |
82 }; | 83 }; |
83 | 84 |
84 class MessageCountFilter : public IPC::ChannelProxy::MessageFilter { | 85 class MessageCountFilter : public IPC::MessageFilter { |
85 public: | 86 public: |
86 MessageCountFilter() | 87 MessageCountFilter() |
87 : messages_received_(0), | 88 : messages_received_(0), |
88 supported_message_class_(0), | 89 supported_message_class_(0), |
89 is_global_filter_(true), | 90 is_global_filter_(true), |
90 filter_removed_(false), | 91 filter_removed_(false), |
91 message_filtering_enabled_(false) {} | 92 message_filtering_enabled_(false) {} |
92 | 93 |
93 MessageCountFilter(uint32 supported_message_class) | 94 MessageCountFilter(uint32 supported_message_class) |
94 : messages_received_(0), | 95 : messages_received_(0), |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 IPC::Channel::MODE_CLIENT, | 262 IPC::Channel::MODE_CLIENT, |
262 &listener); | 263 &listener); |
263 CHECK(channel.Connect()); | 264 CHECK(channel.Connect()); |
264 listener.Init(&channel); | 265 listener.Init(&channel); |
265 | 266 |
266 base::MessageLoop::current()->Run(); | 267 base::MessageLoop::current()->Run(); |
267 return 0; | 268 return 0; |
268 } | 269 } |
269 | 270 |
270 } // namespace | 271 } // namespace |
OLD | NEW |