diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 01:00:22 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 01:00:22 +0000 |
commit | bb97536b768ac68fcbc4605c35461a798ef6e5ff (patch) | |
tree | 479bde96cd05a9e1f9d2746dd82313e2eb715e8e /base/multiprocess_test.h | |
parent | 8731a63268015f4e5d684833c11a1b44bd9ae468 (diff) | |
download | chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.zip chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.tar.gz chromium_src-bb97536b768ac68fcbc4605c35461a798ef6e5ff.tar.bz2 |
Make CommandLine into a normal object, with some statics for getting at the current process's command line.
One explicit goal of this change is to *not* deal with the string/wstring issues at the API on POSIX; the functions are the same as before, which means they remain as broken as before. (I did try to fix the internals, though, so migrating the callers is now possible by adding platform-appropriate hooks.)
Review URL: http://codereview.chromium.org/18248
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/multiprocess_test.h')
-rw-r--r-- | base/multiprocess_test.h | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/base/multiprocess_test.h b/base/multiprocess_test.h index 4f3200e..99c2c79 100644 --- a/base/multiprocess_test.h +++ b/base/multiprocess_test.h @@ -81,7 +81,6 @@ class MultiProcessTest : public PlatformTest { bool debug_on_start) { return SpawnChildImpl(procname, fds_to_map, debug_on_start); } - #endif private: @@ -89,37 +88,31 @@ class MultiProcessTest : public PlatformTest { base::ProcessHandle SpawnChildImpl( const std::wstring& procname, bool debug_on_start) { - CommandLine cl; + CommandLine cl(*CommandLine::ForCurrentProcess()); base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL); - std::wstring clstr = cl.command_line_string(); - CommandLine::AppendSwitchWithValue(&clstr, kRunClientProcess, procname); + cl.AppendSwitchWithValue(kRunClientProcess, procname); - if (debug_on_start) { - CommandLine::AppendSwitch(&clstr, switches::kDebugOnStart); - } + if (debug_on_start) + cl.AppendSwitch(switches::kDebugOnStart); - base::LaunchApp(clstr, false, true, &handle); + base::LaunchApp(cl, 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. base::ProcessHandle SpawnChildImpl( const std::wstring& procname, const base::file_handle_mapping_vector& fds_to_map, bool debug_on_start) { - CommandLine cl; + CommandLine cl(*CommandLine::ForCurrentProcess()); base::ProcessHandle handle = static_cast<base::ProcessHandle>(NULL); + cl.AppendSwitchWithValue(kRunClientProcess, procname); - std::vector<std::string> clvec(cl.argv()); - std::wstring wswitchstr = - CommandLine::PrefixedSwitchStringWithValue(kRunClientProcess, - procname); - if (debug_on_start) { - CommandLine::AppendSwitch(&wswitchstr, switches::kDebugOnStart); - } + if (debug_on_start) + cl.AppendSwitch(switches::kDebugOnStart); - std::string switchstr = WideToUTF8(wswitchstr); - clvec.push_back(switchstr.c_str()); - base::LaunchApp(clvec, fds_to_map, false, &handle); + base::LaunchApp(cl.argv(), fds_to_map, false, &handle); return handle; } #endif |