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

Unified Diff: base/multiprocess_test.h

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 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 | « base/logging.cc ('k') | base/perf_test_suite.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/multiprocess_test.h
diff --git a/base/multiprocess_test.h b/base/multiprocess_test.h
index 4f3200e7a8d73bc477c910dedd33fa3a671370ef..99c2c795250e6c8334f61323ad052db408c96b90 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
« no previous file with comments | « base/logging.cc ('k') | base/perf_test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698