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_IMPL_H_ |
| 6 #define SERVICES_NATIVE_SUPPORT_PROCESS_IMPL_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/task_runner.h" |
| 14 #include "mojo/public/cpp/bindings/interface_request.h" |
| 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 16 #include "mojo/services/native_support/public/interfaces/process.mojom.h" |
| 17 |
| 18 namespace mojo { |
| 19 class ApplicationConnection; |
| 20 } |
| 21 |
| 22 namespace native_support { |
| 23 |
| 24 class ProcessIORedirection; |
| 25 |
| 26 class ProcessImpl : public Process { |
| 27 public: |
| 28 ProcessImpl(scoped_refptr<base::TaskRunner> worker_runner, |
| 29 mojo::ApplicationConnection* connection, |
| 30 mojo::InterfaceRequest<Process> request); |
| 31 ~ProcessImpl() override; |
| 32 |
| 33 // |Process| implementation: |
| 34 void Spawn(const mojo::String& path, |
| 35 mojo::Array<mojo::String> argv, |
| 36 mojo::Array<mojo::String> envp, |
| 37 mojo::files::FilePtr stdin_file, |
| 38 mojo::files::FilePtr stdout_file, |
| 39 mojo::files::FilePtr stderr_file, |
| 40 mojo::InterfaceRequest<ProcessController> process_controller, |
| 41 const SpawnCallback& callback) override; |
| 42 void SpawnWithTerminal( |
| 43 const mojo::String& path, |
| 44 mojo::Array<mojo::String> argv, |
| 45 mojo::Array<mojo::String> envp, |
| 46 mojo::files::FilePtr terminal_file, |
| 47 mojo::InterfaceRequest<ProcessController> process_controller, |
| 48 const SpawnWithTerminalCallback& callback) override; |
| 49 |
| 50 private: |
| 51 // Note: We take advantage of the fact that |SpawnCallback| and |
| 52 // |SpawnWithTerminalCallback| are the same. |
| 53 void SpawnImpl(const mojo::String& path, |
| 54 mojo::Array<mojo::String> argv, |
| 55 mojo::Array<mojo::String> envp, |
| 56 std::unique_ptr<ProcessIORedirection> process_io_redirection, |
| 57 const std::vector<int>& fds_to_inherit, |
| 58 mojo::InterfaceRequest<ProcessController> process_controller, |
| 59 const SpawnCallback& callback); |
| 60 |
| 61 scoped_refptr<base::TaskRunner> worker_runner_; |
| 62 mojo::StrongBinding<Process> binding_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(ProcessImpl); |
| 65 }; |
| 66 |
| 67 } // namespace native_support |
| 68 |
| 69 #endif // SERVICES_NATIVE_SUPPORT_PROCESS_IMPL_H_ |
OLD | NEW |