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

Unified Diff: base/multiprocess_test.h

Issue 555192: Add a utility function to run a process as an arbitrary user... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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
« no previous file with comments | « no previous file | base/process.h » ('j') | base/process_util_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/multiprocess_test.h
===================================================================
--- base/multiprocess_test.h (revision 37643)
+++ base/multiprocess_test.h (working copy)
@@ -83,21 +83,25 @@
}
#endif
- private:
-#if defined(OS_WIN)
- base::ProcessHandle SpawnChildImpl(
- const std::wstring& procname,
- bool debug_on_start) {
+protected:
+ CommandLine MakeCmdLine(const std::wstring& procname, bool debug_on_start) {
CommandLine cl(*CommandLine::ForCurrentProcess());
- base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL);
cl.AppendSwitchWithValue(kRunClientProcess, procname);
-
if (debug_on_start)
cl.AppendSwitch(switches::kDebugOnStart);
+ return cl;
+ }
- base::LaunchApp(cl, false, true, &handle);
+ private:
+#if defined(OS_WIN)
+ base::ProcessHandle SpawnChildImpl(const std::wstring& procname,
+ bool debug_on_start) {
+ base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL);
+ base::LaunchApp(MakeCmdLine(procname, debug_on_start),
+ false, true, &handle);
return handle;
}
+
#elif defined(OS_POSIX)
// TODO(port): with the CommandLine refactoring, this code is very similar
// to the Windows code. Investigate whether this can be made shorter.
@@ -105,14 +109,9 @@
const std::wstring& procname,
const base::file_handle_mapping_vector& fds_to_map,
bool debug_on_start) {
- CommandLine cl(*CommandLine::ForCurrentProcess());
base::ProcessHandle handle = base::kNullProcessHandle;
- cl.AppendSwitchWithValue(kRunClientProcess, procname);
-
- if (debug_on_start)
- cl.AppendSwitch(switches::kDebugOnStart);
-
- base::LaunchApp(cl.argv(), fds_to_map, false, &handle);
+ base::LaunchApp(MakeCmdLine(procname, debug_on_start).argv(),
+ fds_to_map, false, &handle);
return handle;
}
#endif
« no previous file with comments | « no previous file | base/process.h » ('j') | base/process_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698