OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 // Operations are command-line invocations. Like a process, they can have output |
| 6 // and an exit code. But an operation does not necessarily correspond to a |
| 7 // single process. For example, the operation can complete while the launched |
| 8 // process continues to perform other tasks, or the launched process might exit |
| 9 // while the operation is completed by other processes. |
| 10 // |
| 11 // An executable implements an operation by accepting three additional arguments |
| 12 // on the command-line: |
| 13 // |
| 14 // switches::kTaskRemoteProcessId |
| 15 // The process ID of the operation client |
| 16 // |
| 17 // switches::kTaskOutputHandle |
| 18 // A writable HANDLE, valid in the client process, which should be used to |
| 19 // write the operation output. |
| 20 // |
| 21 // switches::kTaskResultHandle |
| 22 // A writable HANDLE, valid in the client process, which should be used to |
| 23 // write the operation exit code (as a binary DWORD). |
| 24 // |
| 25 // LaunchOperation (declared below) will add these parameters to the operation |
| 26 // command-line before invoking it to launch the original operation process. The |
| 27 // HANDLEs will only be valid during the lifetime of the original operation |
| 28 // process; therefore the operation implementation MUST be sure to duplicate |
| 29 // them before it exits if it is delegating to a tertiary process. |
| 30 |
| 31 #ifndef APPS_APP_HOST_OPERATION_LAUNCHER_H_ |
| 32 #define APPS_APP_HOST_OPERATION_LAUNCHER_H_ |
| 33 |
| 34 #include <windows.h> |
| 35 |
| 36 class CommandLine; |
| 37 |
| 38 namespace app_host { |
| 39 |
| 40 // Runs |command_line|, passing anonymous pipes to be used for operation output |
| 41 // and exit code. To prevent deadlocks, |output_write| must be drained somehow |
| 42 // (otherwise the operation may block while writing its output if the pipe's |
| 43 // buffer is full). In production code it will typically be the terminal of the |
| 44 // current process. |
| 45 // Returns true if the operation is successfully launched and its exit code |
| 46 // received. |
| 47 bool LaunchOperation(const CommandLine& command_line, |
| 48 HANDLE output_write, |
| 49 DWORD* exit_code); |
| 50 |
| 51 } // namespace app_host |
| 52 |
| 53 #endif // APPS_APP_HOST_OPERATION_LAUNCHER_H_ |
OLD | NEW |