| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #elif defined(OS_POSIX) | 42 #elif defined(OS_POSIX) |
| 43 platform_channel.reset(mojo::edk::PlatformHandle( | 43 platform_channel.reset(mojo::edk::PlatformHandle( |
| 44 base::GlobalDescriptors::GetInstance()->Get(kMojoIPCChannel))); | 44 base::GlobalDescriptors::GetInstance()->Get(kMojoIPCChannel))); |
| 45 #endif | 45 #endif |
| 46 CHECK(platform_channel.is_valid()); | 46 CHECK(platform_channel.is_valid()); |
| 47 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); | 47 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 ReplayProcess::ReplayProcess() | 50 ReplayProcess::ReplayProcess() |
| 51 : io_thread_("Chrome_ChildIOThread"), | 51 : io_thread_("Chrome_ChildIOThread"), |
| 52 shutdown_event_(true, false), | 52 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 53 message_index_(0) { | 53 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 54 } | 54 message_index_(0) {} |
| 55 | 55 |
| 56 ReplayProcess::~ReplayProcess() { | 56 ReplayProcess::~ReplayProcess() { |
| 57 channel_.reset(); | 57 channel_.reset(); |
| 58 | 58 |
| 59 // Signal this event before shutting down the service process. That way all | 59 // Signal this event before shutting down the service process. That way all |
| 60 // background threads can cleanup. | 60 // background threads can cleanup. |
| 61 shutdown_event_.Signal(); | 61 shutdown_event_.Signal(); |
| 62 io_thread_.Stop(); | 62 io_thread_.Stop(); |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void ReplayProcess::OnChannelError() { | 165 void ReplayProcess::OnChannelError() { |
| 166 LOG(ERROR) << "Channel error, quitting after " | 166 LOG(ERROR) << "Channel error, quitting after " |
| 167 << message_index_ << " messages"; | 167 << message_index_ << " messages"; |
| 168 base::MessageLoop::current()->QuitWhenIdle(); | 168 base::MessageLoop::current()->QuitWhenIdle(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace ipc_fuzzer | 171 } // namespace ipc_fuzzer |
| OLD | NEW |