| Index: content/browser/child_process_launcher.h
|
| diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h
|
| index 7ce780551f462f9c458b730b9ed0ef3a1cadd03c..2f58ed6b05698c65336849ce2f2da0e303c05c2f 100644
|
| --- a/content/browser/child_process_launcher.h
|
| +++ b/content/browser/child_process_launcher.h
|
| @@ -21,39 +21,29 @@ class SandboxedProcessLauncherDelegate;
|
| // on the OS since often it can take > 100 ms to create the process.
|
| class CONTENT_EXPORT ChildProcessLauncher {
|
| public:
|
| + // An interface for receiving callbacks with process-launching status. Will
|
| + // be called on the thread that the ChildProcessLauncher was constructed on.
|
| + // Note that only OnProcessLaunched is required.
|
| class CONTENT_EXPORT Client {
|
| public:
|
| - // Will be called on the thread that the ChildProcessLauncher was
|
| - // constructed on.
|
| + // Called when the process is launched.
|
| virtual void OnProcessLaunched() = 0;
|
|
|
| + // Called if an error occurs launching the process.
|
| + virtual void OnProcessLaunchFailed() {};
|
| +
|
| protected:
|
| virtual ~Client() {}
|
| };
|
|
|
| - // Launches the process asynchronously, calling the client when the result is
|
| - // ready. Deleting this object before the process is created is safe, since
|
| - // the callback won't be called. If the process is still running by the time
|
| - // this object destructs, it will be terminated.
|
| - // Takes ownership of cmd_line.
|
| - ChildProcessLauncher(
|
| -#if defined(OS_WIN)
|
| - SandboxedProcessLauncherDelegate* delegate,
|
| -#elif defined(OS_POSIX)
|
| - bool use_zygote,
|
| - const base::EnvironmentMap& environ,
|
| - int ipcfd,
|
| -#endif
|
| - CommandLine* cmd_line,
|
| - int child_process_id,
|
| - Client* client);
|
| - ~ChildProcessLauncher();
|
| + ChildProcessLauncher() {};
|
| + virtual ~ChildProcessLauncher() {};
|
|
|
| // True if the process is being launched and so the handle isn't available.
|
| - bool IsStarting();
|
| + virtual bool IsStarting() = 0;
|
|
|
| // Getter for the process handle. Only call after the process has started.
|
| - base::ProcessHandle GetHandle();
|
| + virtual base::ProcessHandle GetHandle() = 0;
|
|
|
| // Call this when the child process exits to know what happened to it.
|
| // |known_dead| can be true if we already know the process is dead as it can
|
| @@ -66,22 +56,44 @@ class CONTENT_EXPORT ChildProcessLauncher {
|
| // |exit_code| is the exit code of the process if it exited (e.g. status from
|
| // waitpid if on posix, from GetExitCodeProcess on Windows). |exit_code| may
|
| // be NULL.
|
| - base::TerminationStatus GetChildTerminationStatus(bool known_dead,
|
| - int* exit_code);
|
| + virtual base::TerminationStatus GetChildTerminationStatus(bool known_dead,
|
| + int* exit_code) = 0;
|
|
|
| // Changes whether the process runs in the background or not. Only call
|
| // this after the process has started.
|
| - void SetProcessBackgrounded(bool background);
|
| + virtual void SetProcessBackgrounded(bool background) = 0;
|
|
|
| // Controls whether the child process should be terminated on browser
|
| // shutdown.
|
| - void SetTerminateChildOnShutdown(bool terminate_on_shutdown);
|
| + virtual void SetTerminateChildOnShutdown(bool terminate_on_shutdown) = 0;
|
|
|
| - private:
|
| - class Context;
|
| + // Launches the process asynchronously, calling the client when the result is
|
| + // ready. Deleting this object before the process is created is safe, since
|
| + // the callback won't be called. If the process is still running by the time
|
| + // this object destructs, it will be terminated.
|
| + // Takes ownership of |cmd_line|.
|
| + static ChildProcessLauncher* Create(
|
| +#if defined(OS_WIN)
|
| + SandboxedProcessLauncherDelegate* delegate,
|
| +#elif defined(OS_POSIX)
|
| + bool use_zygote,
|
| + const base::EnvironmentMap& environ,
|
| + int ipcfd,
|
| +#endif
|
| + CommandLine* cmd_line,
|
| + int child_process_id,
|
| + Client* client);
|
|
|
| - scoped_refptr<Context> context_;
|
| +#if defined(OS_WIN)
|
| + // Create a ChildProcessLauncher that attempts to create an elevated process.
|
| + // See |Create|.
|
| + static ChildProcessLauncher* CreateElevated(
|
| + CommandLine* cmd_line,
|
| + int child_process_id,
|
| + Client* client);
|
| +#endif
|
|
|
| + private:
|
| DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher);
|
| };
|
|
|
|
|