| Index: content/browser/child_process_launcher.h
|
| diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h
|
| index 8e1e1b319e33352c1c209f4de0c8ef495306f3dc..6a17aa027db825eb4f990086f11dfefa2ee8b833 100644
|
| --- a/content/browser/child_process_launcher.h
|
| +++ b/content/browser/child_process_launcher.h
|
| @@ -5,31 +5,31 @@
|
| #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
|
| #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
|
|
|
| -#include "base/files/scoped_file.h"
|
| +#include <memory>
|
| +
|
| #include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/memory/shared_memory.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/process/kill.h"
|
| -#include "base/process/launch.h"
|
| #include "base/process/process.h"
|
| #include "base/threading/non_thread_safe.h"
|
| #include "build/build_config.h"
|
| +#include "content/browser/child_process_launcher_helper.h"
|
| #include "content/common/content_export.h"
|
| #include "content/public/browser/browser_thread.h"
|
| -#include "content/public/common/sandboxed_process_launcher_delegate.h"
|
| +#include "content/public/common/result_codes.h"
|
| #include "mojo/edk/embedder/embedder.h"
|
| #include "mojo/edk/embedder/scoped_platform_handle.h"
|
|
|
| -#if defined(OS_WIN)
|
| -#include "sandbox/win/src/sandbox_types.h"
|
| -#endif
|
| -
|
| namespace base {
|
| class CommandLine;
|
| }
|
|
|
| namespace content {
|
|
|
| +class SandboxedProcessLauncherDelegate;
|
| +
|
| // Note: These codes are listed in a histogram and any new codes should be added
|
| // at the end.
|
| enum LaunchResultCode {
|
| @@ -109,44 +109,42 @@ class CONTENT_EXPORT ChildProcessLauncher : public base::NonThreadSafe {
|
| // this after the process has started.
|
| void SetProcessBackgrounded(bool background);
|
|
|
| + // Terminates the process associated with this ChildProcessLauncher.
|
| + // Returns true if the process was stopped, false if the process had not been
|
| + // started yet or could not be stopped.
|
| + // Note that |exit_code| and |wait| are not used on Android.
|
| + bool Terminate(int exit_code, bool wait);
|
| +
|
| + // Similar to Terminate() but takes in a |process|.
|
| + // On Android |process| must have been started by ChildProcessLauncher for
|
| + // this method to work.
|
| + static bool TerminateProcess(const base::Process& process,
|
| + int exit_code,
|
| + bool wait);
|
| +
|
| // Replaces the ChildProcessLauncher::Client for testing purposes. Returns the
|
| // previous client.
|
| Client* ReplaceClientForTest(Client* client);
|
|
|
| private:
|
| - // Posts a task to the launcher thread to do the actual work.
|
| - void Launch(std::unique_ptr<SandboxedProcessLauncherDelegate> delegate,
|
| - std::unique_ptr<base::CommandLine> cmd_line,
|
| - int child_process_id);
|
| + friend class internal::ChildProcessLauncherHelper;
|
|
|
| void UpdateTerminationStatus(bool known_dead);
|
|
|
| - // This is always called on the client thread after an attempt
|
| - // to launch the child process on the launcher thread.
|
| - // It makes sure we always perform the necessary cleanup if the
|
| - // client went away.
|
| - static void DidLaunch(base::WeakPtr<ChildProcessLauncher> instance,
|
| - bool terminate_on_shutdown,
|
| - mojo::edk::ScopedPlatformHandle server_handle,
|
| - ZygoteHandle zygote,
|
| -#if defined(OS_ANDROID)
|
| - base::ScopedFD mojo_fd,
|
| -#endif
|
| - base::Process process,
|
| - int error_code);
|
| -
|
| // Notifies the client about the result of the operation.
|
| - void Notify(ZygoteHandle zygote,
|
| + void Notify(internal::ChildProcessLauncherHelper::Process process,
|
| mojo::edk::ScopedPlatformHandle server_handle,
|
| - base::Process process,
|
| int error_code);
|
|
|
| Client* client_;
|
| BrowserThread::ID client_thread_id_;
|
| - base::Process process_;
|
| +
|
| + // The process associated with this ChildProcessLauncher. Set in Notify by
|
| + // ChildProcessLauncherHelper once the process was started.
|
| + internal::ChildProcessLauncherHelper::Process process_;
|
| +
|
| base::TerminationStatus termination_status_;
|
| int exit_code_;
|
| - ZygoteHandle zygote_;
|
| bool starting_;
|
| const mojo::edk::ProcessErrorCallback process_error_callback_;
|
|
|
| @@ -156,6 +154,8 @@ class CONTENT_EXPORT ChildProcessLauncher : public base::NonThreadSafe {
|
|
|
| const std::string mojo_child_token_;
|
|
|
| + scoped_refptr<internal::ChildProcessLauncherHelper> helper_;
|
| +
|
| base::WeakPtrFactory<ChildProcessLauncher> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher);
|
|
|