| 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" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 | 101 |
| 102 void ReplayProcess::OpenChannel() { | 102 void ReplayProcess::OpenChannel() { |
| 103 // TODO(morrita): As the adoption of ChannelMojo spreads, this | 103 // TODO(morrita): As the adoption of ChannelMojo spreads, this |
| 104 // criteria has to be updated. | 104 // criteria has to be updated. |
| 105 std::string process_type = | 105 std::string process_type = |
| 106 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 106 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 107 switches::kProcessType); | 107 switches::kProcessType); |
| 108 bool should_use_mojo = process_type == switches::kRendererProcess && | 108 bool should_use_mojo = process_type == switches::kRendererProcess; |
| 109 content::ShouldUseMojoChannel(); | |
| 110 if (should_use_mojo) { | 109 if (should_use_mojo) { |
| 111 std::string token = | 110 std::string token = |
| 112 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 111 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 113 switches::kMojoChannelToken); | 112 switches::kMojoChannelToken); |
| 114 channel_ = IPC::ChannelProxy::Create( | 113 channel_ = IPC::ChannelProxy::Create( |
| 115 IPC::ChannelMojo::CreateClientFactory(mojo::edk::CreateChildMessagePipe( | 114 IPC::ChannelMojo::CreateClientFactory(mojo::edk::CreateChildMessagePipe( |
| 116 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 115 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 117 switches::kMojoChannelToken))), | 116 switches::kMojoChannelToken))), |
| 118 this, io_thread_.task_runner()); | 117 this, io_thread_.task_runner()); |
| 119 } else { | 118 } else { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return true; | 162 return true; |
| 164 } | 163 } |
| 165 | 164 |
| 166 void ReplayProcess::OnChannelError() { | 165 void ReplayProcess::OnChannelError() { |
| 167 LOG(ERROR) << "Channel error, quitting after " | 166 LOG(ERROR) << "Channel error, quitting after " |
| 168 << message_index_ << " messages"; | 167 << message_index_ << " messages"; |
| 169 base::MessageLoop::current()->QuitWhenIdle(); | 168 base::MessageLoop::current()->QuitWhenIdle(); |
| 170 } | 169 } |
| 171 | 170 |
| 172 } // namespace ipc_fuzzer | 171 } // namespace ipc_fuzzer |
| OLD | NEW |