Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: content/browser/child_process_launcher_impl.h

Issue 98603007: Launches a privileged utility process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleans up formatting and removes some unnecessary functions. Adds an additional non-elevated white… Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/child_process_launcher_impl.h
diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher_impl.h
similarity index 69%
copy from content/browser/child_process_launcher.h
copy to content/browser/child_process_launcher_impl.h
index 7ce780551f462f9c458b730b9ed0ef3a1cadd03c..17daf5ffb0aad458e875d9766bdfcf8cf1fd90ad 100644
--- a/content/browser/child_process_launcher.h
+++ b/content/browser/child_process_launcher_impl.h
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
-#define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
+#ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_IMPL_H_
+#define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_IMPL_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
+#include "content/browser/child_process_launcher.h"
#include "content/common/content_export.h"
class CommandLine;
@@ -16,27 +17,15 @@ class CommandLine;
namespace content {
class SandboxedProcessLauncherDelegate;
-// Launches a process asynchronously and notifies the client of the process
-// handle when it's available. It's used to avoid blocking the calling thread
-// on the OS since often it can take > 100 ms to create the process.
-class CONTENT_EXPORT ChildProcessLauncher {
+// All standard process-launching uses this class to launch the process.
+class CONTENT_EXPORT ChildProcessLauncherImpl : public ChildProcessLauncher {
jam 2014/01/24 22:14:03 why are you adding an interface around ChildProces
Drew Haven 2014/01/27 21:43:51 When I started writing this I only added the Launc
jam 2014/01/27 21:55:45 Yeah, please use one implementation. child_process
public:
- class CONTENT_EXPORT Client {
- public:
- // Will be called on the thread that the ChildProcessLauncher was
- // constructed on.
- virtual void OnProcessLaunched() = 0;
-
- 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(
+ ChildProcessLauncherImpl(
#if defined(OS_WIN)
SandboxedProcessLauncherDelegate* delegate,
#elif defined(OS_POSIX)
@@ -47,13 +36,14 @@ class CONTENT_EXPORT ChildProcessLauncher {
CommandLine* cmd_line,
int child_process_id,
Client* client);
- ~ChildProcessLauncher();
+
+ ~ChildProcessLauncherImpl();
// True if the process is being launched and so the handle isn't available.
- bool IsStarting();
+ virtual bool IsStarting() OVERRIDE;
// Getter for the process handle. Only call after the process has started.
- base::ProcessHandle GetHandle();
+ virtual base::ProcessHandle GetHandle() OVERRIDE;
// 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,25 +56,25 @@ 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) OVERRIDE;
// 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) OVERRIDE;
// Controls whether the child process should be terminated on browser
// shutdown.
- void SetTerminateChildOnShutdown(bool terminate_on_shutdown);
+ virtual void SetTerminateChildOnShutdown(bool terminate_on_shutdown) OVERRIDE;
private:
class Context;
scoped_refptr<Context> context_;
- DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher);
+ DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncherImpl);
};
} // namespace content
-#endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_
+#endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698