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 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // TODO(morrita): As the adoption of ChannelMojo spreads, this | 87 // TODO(morrita): As the adoption of ChannelMojo spreads, this |
88 // criteria has to be updated. | 88 // criteria has to be updated. |
89 std::string process_type = | 89 std::string process_type = |
90 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 90 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
91 switches::kProcessType); | 91 switches::kProcessType); |
92 bool should_use_mojo = process_type == switches::kRendererProcess && | 92 bool should_use_mojo = process_type == switches::kRendererProcess && |
93 content::ShouldUseMojoChannel(); | 93 content::ShouldUseMojoChannel(); |
94 if (should_use_mojo) { | 94 if (should_use_mojo) { |
95 channel_ = IPC::ChannelProxy::Create( | 95 channel_ = IPC::ChannelProxy::Create( |
96 IPC::ChannelMojo::CreateClientFactory( | 96 IPC::ChannelMojo::CreateClientFactory( |
97 nullptr, io_thread_.message_loop_proxy(), channel_name), this, | 97 nullptr, io_thread_.task_runner(), channel_name), this, |
98 io_thread_.message_loop_proxy()); | 98 io_thread_.task_runner()); |
99 } else { | 99 } else { |
100 channel_ = | 100 channel_ = |
101 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, | 101 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, |
102 io_thread_.message_loop_proxy()); | 102 io_thread_.task_runner()); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 bool ReplayProcess::OpenTestcase() { | 106 bool ReplayProcess::OpenTestcase() { |
107 base::FilePath path = | 107 base::FilePath path = |
108 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 108 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
109 switches::kIpcFuzzerTestcase); | 109 switches::kIpcFuzzerTestcase); |
110 return MessageFile::Read(path, &messages_); | 110 return MessageFile::Read(path, &messages_); |
111 } | 111 } |
112 | 112 |
(...skipping 27 matching lines...) Expand all Loading... |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 void ReplayProcess::OnChannelError() { | 143 void ReplayProcess::OnChannelError() { |
144 LOG(ERROR) << "Channel error, quitting after " | 144 LOG(ERROR) << "Channel error, quitting after " |
145 << message_index_ << " messages"; | 145 << message_index_ << " messages"; |
146 base::MessageLoop::current()->Quit(); | 146 base::MessageLoop::current()->Quit(); |
147 } | 147 } |
148 | 148 |
149 } // namespace ipc_fuzzer | 149 } // namespace ipc_fuzzer |
OLD | NEW |