| 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_ = IPC::ChannelProxy::CreateClient( | 58 channel_.reset( |
| 59 channel_name, this, io_thread_.message_loop_proxy()); | 59 new IPC::ChannelProxy(channel_name, |
| 60 IPC::Channel::MODE_CLIENT, |
| 61 this, |
| 62 io_thread_.message_loop_proxy())); |
| 60 } | 63 } |
| 61 | 64 |
| 62 bool ReplayProcess::OpenTestcase() { | 65 bool ReplayProcess::OpenTestcase() { |
| 63 base::FilePath path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 66 base::FilePath path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 64 switches::kIpcFuzzerTestcase); | 67 switches::kIpcFuzzerTestcase); |
| 65 return MessageFile::Read(path, &messages_); | 68 return MessageFile::Read(path, &messages_); |
| 66 } | 69 } |
| 67 | 70 |
| 68 void ReplayProcess::SendNextMessage() { | 71 void ReplayProcess::SendNextMessage() { |
| 69 if (message_index_ >= messages_.size()) { | 72 if (message_index_ >= messages_.size()) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 95 return true; | 98 return true; |
| 96 } | 99 } |
| 97 | 100 |
| 98 void ReplayProcess::OnChannelError() { | 101 void ReplayProcess::OnChannelError() { |
| 99 LOG(ERROR) << "Channel error, quitting after " | 102 LOG(ERROR) << "Channel error, quitting after " |
| 100 << message_index_ << " messages"; | 103 << message_index_ << " messages"; |
| 101 base::MessageLoop::current()->Quit(); | 104 base::MessageLoop::current()->Quit(); |
| 102 } | 105 } |
| 103 | 106 |
| 104 } // namespace ipc_fuzzer | 107 } // namespace ipc_fuzzer |
| OLD | NEW |