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

Unified Diff: net/tools/dump_cache/dump_cache.cc

Issue 7386002: Rename CommandLine::GetCommandLineString(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge. Created 9 years, 5 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 | « net/test/test_server_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/dump_cache/dump_cache.cc
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc
index ee5a50efe6e63e3e32181f7e42d3dcd990d72460..59b85f810bc601601c152d7b98db56a1fcd35e51 100644
--- a/net/tools/dump_cache/dump_cache.cc
+++ b/net/tools/dump_cache/dump_cache.cc
@@ -71,35 +71,25 @@ int Help() {
}
// Starts a new process, to generate the files.
-int LaunchSlave(const CommandLine& command_line,
- const std::wstring& pipe_number, int version) {
- // TODO(port): remove this string-munging hackery.
- std::wstring hacked_command_line = command_line.command_line_string();
- const std::wstring old_exe(L"dump_cache");
- size_t to_remove = hacked_command_line.find(old_exe);
- hacked_command_line.erase(to_remove, old_exe.size());
-
+int LaunchSlave(CommandLine command_line,
+ const std::wstring& pipe_number,
+ int version) {
bool do_upgrade = command_line.HasSwitch(kUpgrade);
bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles);
- std::wstring new_program;
- if (do_upgrade)
- new_program = base::StringPrintf(L"%ls%d", L"dump_cache_", version);
- else
- new_program = base::StringPrintf(L"dump_cache");
-
- hacked_command_line.insert(to_remove, new_program);
-
- CommandLine new_command_line = CommandLine::FromString(hacked_command_line);
+ if (do_upgrade) {
+ FilePath program(base::StringPrintf(L"%ls%d", L"dump_cache", version));
+ command_line.SetProgram(program);
+ }
if (do_upgrade || do_convert_to_text)
- new_command_line.AppendSwitch(kSlave);
+ command_line.AppendSwitch(kSlave);
// TODO(evanm): remove needless usage of wstring from here and elsewhere.
- new_command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number));
- if (!base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL)) {
+ command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number));
+ if (!base::LaunchProcess(command_line, base::LaunchOptions(), NULL)) {
printf("Unable to launch the needed version of this tool: %ls\n",
- new_program.c_str());
+ command_line.GetProgram().value().c_str());
printf(kUpgradeHelp);
return TOOL_NOT_FOUND;
}
« no previous file with comments | « net/test/test_server_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698