| 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/replay/replay_process.h" | 5 #include "tools/ipc_fuzzer/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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 g_fds->Set(kPrimaryIPCChannel, | 48 g_fds->Set(kPrimaryIPCChannel, |
| 49 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); | 49 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ReplayProcess::OpenChannel() { | 53 void ReplayProcess::OpenChannel() { |
| 54 std::string channel_name = | 54 std::string channel_name = |
| 55 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 55 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 56 switches::kProcessChannelID); | 56 switches::kProcessChannelID); |
| 57 | 57 |
| 58 channel_.reset( | 58 channel_ = IPC::ChannelProxy::Create(channel_name, |
| 59 new IPC::ChannelProxy(channel_name, | 59 IPC::Channel::MODE_CLIENT, |
| 60 IPC::Channel::MODE_CLIENT, | 60 this, |
| 61 this, | 61 io_thread_.message_loop_proxy()); |
| 62 io_thread_.message_loop_proxy())); | |
| 63 } | 62 } |
| 64 | 63 |
| 65 bool ReplayProcess::OpenTestcase() { | 64 bool ReplayProcess::OpenTestcase() { |
| 66 base::FilePath path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 65 base::FilePath path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 67 switches::kIpcFuzzerTestcase); | 66 switches::kIpcFuzzerTestcase); |
| 68 return MessageFile::Read(path, &messages_); | 67 return MessageFile::Read(path, &messages_); |
| 69 } | 68 } |
| 70 | 69 |
| 71 void ReplayProcess::SendNextMessage() { | 70 void ReplayProcess::SendNextMessage() { |
| 72 if (message_index_ >= messages_.size()) { | 71 if (message_index_ >= messages_.size()) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 98 return true; | 97 return true; |
| 99 } | 98 } |
| 100 | 99 |
| 101 void ReplayProcess::OnChannelError() { | 100 void ReplayProcess::OnChannelError() { |
| 102 LOG(ERROR) << "Channel error, quitting after " | 101 LOG(ERROR) << "Channel error, quitting after " |
| 103 << message_index_ << " messages"; | 102 << message_index_ << " messages"; |
| 104 base::MessageLoop::current()->Quit(); | 103 base::MessageLoop::current()->Quit(); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace ipc_fuzzer | 106 } // namespace ipc_fuzzer |
| OLD | NEW |