Chromium Code Reviews| Index: apps/app_host/operation_launcher.h |
| diff --git a/apps/app_host/operation_launcher.h b/apps/app_host/operation_launcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9e3a9470e019337a3a1fe78466a4fb2ab22f58b5 |
| --- /dev/null |
| +++ b/apps/app_host/operation_launcher.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +// |
| +// Operations are command-line invocations. Like a process, they can have output |
| +// and an exit code. But an operation does not necessarily correspond to a |
| +// single process. For example, the operation can complete while the launched |
| +// process continues to perform other tasks, or the launched process might exit |
| +// while the operation is completed by other processes. |
| +// |
| +// An executable implements an operation by accepting three additional arguments |
| +// on the command-line: |
| +// |
| +// switches::kTaskRemoteProcessId |
| +// The process ID of the operation client |
| +// |
| +// switches::kTaskOutputHandle |
| +// A writable HANDLE, valid in the client process, which should be used to |
| +// write the operation output. |
| +// |
| +// switches::kTaskResultHandle |
| +// A writable HANDLE, valid in the client process, which should be used to |
| +// write the operation exit code (as a binary DWORD). |
|
gab
2013/03/28 03:06:06
nit: Indent 2nd line of comment 2 more spaces
gab
2013/03/28 03:06:06
s/(as a binary DWORD)/(as a DWORD)
?
How can a DWO
erikwright (departed)
2013/04/18 17:43:04
I guess I meant in binary format as opposed to bei
erikwright (departed)
2013/04/18 17:43:04
Done.
|
| +// |
| +// LaunchOperation (declared below) will add these parameters to the operation |
| +// command-line before invoking it to launch the original operation process. The |
| +// HANDLEs will only be valid during the lifetime of the original operation |
| +// process; therefore the operation implementation MUST be sure to duplicate |
| +// them before it exits if it is delegating to a tertiary process. |
| + |
| +#ifndef APPS_APP_HOST_OPERATION_LAUNCHER_H_ |
| +#define APPS_APP_HOST_OPERATION_LAUNCHER_H_ |
| + |
| +#include <windows.h> |
| + |
| +class CommandLine; |
| + |
| +namespace app_host { |
| + |
| +// Runs the provided command, passing anonymous pipes to be used for operation |
|
gab
2013/03/28 03:06:06
s/command/|command_line/
erikwright (departed)
2013/04/18 17:43:04
Done.
|
| +// output and exit code. To prevent deadlocks, |output_write| must be drained |
|
gab
2013/03/28 03:06:06
Can you add an example of why this could cause a d
erikwright (departed)
2013/04/18 17:43:04
Done.
|
| +// somehow. In production code it will typically be the terminal of the current |
| +// process. |
| +// Returns true if the operation is successfully launched and its exit code |
| +// received. |
| +bool LaunchOperation(const CommandLine& command_line, |
| + HANDLE output_write, |
| + DWORD* exit_code); |
| + |
| +} // namespace app_host |
| + |
| +#endif // APPS_APP_HOST_OPERATION_LAUNCHER_H_ |