OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "tools/ipc_fuzzer/message_replay/replay_process.h" | 5 #include "tools/ipc_fuzzer/message_replay/replay_process.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/posix/global_descriptors.h" | 14 #include "base/posix/global_descriptors.h" |
| 15 #include "base/run_loop.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/mojo_channel_switches.h" | 19 #include "content/public/common/mojo_channel_switches.h" |
19 #include "ipc/ipc_descriptors.h" | 20 #include "ipc/ipc_descriptors.h" |
20 #include "ipc/ipc_switches.h" | 21 #include "ipc/ipc_switches.h" |
21 #include "ipc/mojo/ipc_channel_mojo.h" | 22 #include "ipc/mojo/ipc_channel_mojo.h" |
22 #include "mojo/edk/embedder/embedder.h" | 23 #include "mojo/edk/embedder/embedder.h" |
23 #include "mojo/edk/embedder/platform_channel_pair.h" | 24 #include "mojo/edk/embedder/platform_channel_pair.h" |
24 #include "mojo/edk/embedder/scoped_ipc_support.h" | 25 #include "mojo/edk/embedder/scoped_ipc_support.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 base::MessageLoop::current()->QuitWhenIdle(); | 151 base::MessageLoop::current()->QuitWhenIdle(); |
151 } | 152 } |
152 } | 153 } |
153 | 154 |
154 void ReplayProcess::Run() { | 155 void ReplayProcess::Run() { |
155 timer_.reset(new base::Timer(false, true)); | 156 timer_.reset(new base::Timer(false, true)); |
156 timer_->Start(FROM_HERE, | 157 timer_->Start(FROM_HERE, |
157 base::TimeDelta::FromMilliseconds(1), | 158 base::TimeDelta::FromMilliseconds(1), |
158 base::Bind(&ReplayProcess::SendNextMessage, | 159 base::Bind(&ReplayProcess::SendNextMessage, |
159 base::Unretained(this))); | 160 base::Unretained(this))); |
160 base::MessageLoop::current()->Run(); | 161 base::RunLoop().Run(); |
161 } | 162 } |
162 | 163 |
163 bool ReplayProcess::OnMessageReceived(const IPC::Message& msg) { | 164 bool ReplayProcess::OnMessageReceived(const IPC::Message& msg) { |
164 return true; | 165 return true; |
165 } | 166 } |
166 | 167 |
167 void ReplayProcess::OnChannelError() { | 168 void ReplayProcess::OnChannelError() { |
168 LOG(ERROR) << "Channel error, quitting after " | 169 LOG(ERROR) << "Channel error, quitting after " |
169 << message_index_ << " messages"; | 170 << message_index_ << " messages"; |
170 base::MessageLoop::current()->QuitWhenIdle(); | 171 base::MessageLoop::current()->QuitWhenIdle(); |
171 } | 172 } |
172 | 173 |
173 } // namespace ipc_fuzzer | 174 } // namespace ipc_fuzzer |
OLD | NEW |