| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 io_thread_.StartWithOptions( | 86 io_thread_.StartWithOptions( |
| 87 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 87 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 88 | 88 |
| 89 #if defined(OS_POSIX) | 89 #if defined(OS_POSIX) |
| 90 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); | 90 base::GlobalDescriptors* g_fds = base::GlobalDescriptors::GetInstance(); |
| 91 g_fds->Set(kMojoIPCChannel, | 91 g_fds->Set(kMojoIPCChannel, |
| 92 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor); | 92 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor); |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 mojo_ipc_support_.reset( | 95 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport( |
| 96 new mojo::edk::ScopedIPCSupport(io_thread_.task_runner())); | 96 io_thread_.task_runner(), |
| 97 mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST)); |
| 97 InitializeMojoIPCChannel(); | 98 InitializeMojoIPCChannel(); |
| 98 | 99 |
| 99 return true; | 100 return true; |
| 100 } | 101 } |
| 101 | 102 |
| 102 void ReplayProcess::OpenChannel() { | 103 void ReplayProcess::OpenChannel() { |
| 103 channel_ = IPC::ChannelProxy::Create( | 104 channel_ = IPC::ChannelProxy::Create( |
| 104 IPC::ChannelMojo::CreateClientFactory( | 105 IPC::ChannelMojo::CreateClientFactory( |
| 105 mojo::edk::CreateChildMessagePipe( | 106 mojo::edk::CreateChildMessagePipe( |
| 106 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 107 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return true; | 147 return true; |
| 147 } | 148 } |
| 148 | 149 |
| 149 void ReplayProcess::OnChannelError() { | 150 void ReplayProcess::OnChannelError() { |
| 150 LOG(ERROR) << "Channel error, quitting after " | 151 LOG(ERROR) << "Channel error, quitting after " |
| 151 << message_index_ << " messages"; | 152 << message_index_ << " messages"; |
| 152 base::MessageLoop::current()->QuitWhenIdle(); | 153 base::MessageLoop::current()->QuitWhenIdle(); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace ipc_fuzzer | 156 } // namespace ipc_fuzzer |
| OLD | NEW |