OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "services/native_support/process_impl.h" | 5 #include "services/native_support/process_impl.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 if (setsid() == static_cast<pid_t>(-1)) | 44 if (setsid() == static_cast<pid_t>(-1)) |
45 write(STDERR_FILENO, kErrorMessage, sizeof(kErrorMessage) - 1); | 45 write(STDERR_FILENO, kErrorMessage, sizeof(kErrorMessage) - 1); |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(SetsidPreExecDelegate); | 49 DISALLOW_COPY_AND_ASSIGN(SetsidPreExecDelegate); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace | 52 } // namespace |
53 | 53 |
| 54 // TODO(vtl): This should do something with the |connection_context|. |
54 ProcessImpl::ProcessImpl(scoped_refptr<base::TaskRunner> worker_runner, | 55 ProcessImpl::ProcessImpl(scoped_refptr<base::TaskRunner> worker_runner, |
55 mojo::ApplicationConnection* connection, | 56 const mojo::ConnectionContext& connection_context, |
56 mojo::InterfaceRequest<Process> request) | 57 mojo::InterfaceRequest<Process> request) |
57 : worker_runner_(worker_runner.Pass()), binding_(this, request.Pass()) {} | 58 : worker_runner_(worker_runner.Pass()), binding_(this, request.Pass()) {} |
58 | 59 |
59 ProcessImpl::~ProcessImpl() {} | 60 ProcessImpl::~ProcessImpl() {} |
60 | 61 |
61 void ProcessImpl::Spawn( | 62 void ProcessImpl::Spawn( |
62 mojo::Array<uint8_t> path, | 63 mojo::Array<uint8_t> path, |
63 mojo::Array<mojo::Array<uint8_t>> argv, | 64 mojo::Array<mojo::Array<uint8_t>> argv, |
64 mojo::Array<mojo::Array<uint8_t>> envp, | 65 mojo::Array<mojo::Array<uint8_t>> envp, |
65 mojo::InterfaceHandle<mojo::files::File> stdin_file, | 66 mojo::InterfaceHandle<mojo::files::File> stdin_file, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 callback.Run(mojo::files::Error::UNKNOWN); | 250 callback.Run(mojo::files::Error::UNKNOWN); |
250 return; | 251 return; |
251 } | 252 } |
252 | 253 |
253 new ProcessControllerImpl(worker_runner_, process_controller.Pass(), | 254 new ProcessControllerImpl(worker_runner_, process_controller.Pass(), |
254 process.Pass(), std::move(process_io_redirection)); | 255 process.Pass(), std::move(process_io_redirection)); |
255 callback.Run(mojo::files::Error::OK); | 256 callback.Run(mojo::files::Error::OK); |
256 } | 257 } |
257 | 258 |
258 } // namespace native_support | 259 } // namespace native_support |
OLD | NEW |