OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_NATIVE_SUPPORT_PROCESS_CONTROLLER_IMPL_H_ |
| 6 #define SERVICES_NATIVE_SUPPORT_PROCESS_CONTROLLER_IMPL_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/process/process.h" |
| 14 #include "base/task_runner.h" |
| 15 #include "mojo/public/cpp/bindings/interface_request.h" |
| 16 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 17 #include "mojo/services/files/public/interfaces/file.mojom.h" |
| 18 #include "mojo/services/files/public/interfaces/types.mojom.h" |
| 19 #include "mojo/services/native_support/public/interfaces/process.mojom.h" |
| 20 |
| 21 namespace native_support { |
| 22 |
| 23 class ProcessIORedirection; |
| 24 |
| 25 class ProcessControllerImpl : public ProcessController { |
| 26 public: |
| 27 ProcessControllerImpl( |
| 28 scoped_refptr<base::TaskRunner> worker_runner, |
| 29 mojo::InterfaceRequest<ProcessController> request, |
| 30 base::Process process, |
| 31 std::unique_ptr<ProcessIORedirection> process_io_redirection); |
| 32 ~ProcessControllerImpl() override; |
| 33 |
| 34 // |ProcessController| implementation: |
| 35 void Wait(const WaitCallback& callback) override; |
| 36 void Kill(int32_t signal, const KillCallback& callback) override; |
| 37 |
| 38 private: |
| 39 void OnWaitComplete(const WaitCallback& callback, |
| 40 mojo::files::Error result, |
| 41 int32_t exit_status); |
| 42 |
| 43 mojo::files::Error KillHelper(int32_t signal); |
| 44 |
| 45 scoped_refptr<base::TaskRunner> worker_runner_; |
| 46 mojo::StrongBinding<ProcessController> binding_; |
| 47 base::Process process_; |
| 48 std::unique_ptr<ProcessIORedirection> process_io_redirection_; |
| 49 |
| 50 base::WeakPtrFactory<ProcessControllerImpl> weak_factory_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(ProcessControllerImpl); |
| 53 }; |
| 54 |
| 55 } // namespace native_support |
| 56 |
| 57 #endif // SERVICES_NATIVE_SUPPORT_PROCESS_CONTROLLER_IMPL_H_ |
OLD | NEW |