| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 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(nullptr, channel_name), this, | 96 IPC::ChannelMojo::CreateClientFactory( |
| 97 nullptr, io_thread_.message_loop_proxy(), channel_name), this, |
| 97 io_thread_.message_loop_proxy()); | 98 io_thread_.message_loop_proxy()); |
| 98 } else { | 99 } else { |
| 99 channel_ = | 100 channel_ = |
| 100 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, | 101 IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this, |
| 101 io_thread_.message_loop_proxy()); | 102 io_thread_.message_loop_proxy()); |
| 102 } | 103 } |
| 103 } | 104 } |
| 104 | 105 |
| 105 bool ReplayProcess::OpenTestcase() { | 106 bool ReplayProcess::OpenTestcase() { |
| 106 base::FilePath path = | 107 base::FilePath path = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return true; | 140 return true; |
| 140 } | 141 } |
| 141 | 142 |
| 142 void ReplayProcess::OnChannelError() { | 143 void ReplayProcess::OnChannelError() { |
| 143 LOG(ERROR) << "Channel error, quitting after " | 144 LOG(ERROR) << "Channel error, quitting after " |
| 144 << message_index_ << " messages"; | 145 << message_index_ << " messages"; |
| 145 base::MessageLoop::current()->Quit(); | 146 base::MessageLoop::current()->Quit(); |
| 146 } | 147 } |
| 147 | 148 |
| 148 } // namespace ipc_fuzzer | 149 } // namespace ipc_fuzzer |
| OLD | NEW |