diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-20 04:54:52 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-20 04:54:52 +0000 |
commit | 61a4c6f8372350bedd95d8834c8bfd1b36a27c1b (patch) | |
tree | d2c796ee2336083b018d6a38fc54627b26559498 /net | |
parent | 480ac51965719719beb1761274491acb6eda95e9 (diff) | |
download | chromium_src-61a4c6f8372350bedd95d8834c8bfd1b36a27c1b.zip chromium_src-61a4c6f8372350bedd95d8834c8bfd1b36a27c1b.tar.gz chromium_src-61a4c6f8372350bedd95d8834c8bfd1b36a27c1b.tar.bz2 |
Rename CommandLine::GetCommandLineString().
Fix string hackery in net/tools/dump_cache/dump_cache.cc
Fix const casts in chrome/installer/util/product.cc and base/process_util_win.cc.
BUG=73195
TEST=none
Review URL: http://codereview.chromium.org/7386002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/test/test_server_posix.cc | 2 | ||||
-rw-r--r-- | net/test/test_server_win.cc | 4 | ||||
-rw-r--r-- | net/tools/dump_cache/dump_cache.cc | 32 |
3 files changed, 14 insertions, 24 deletions
diff --git a/net/test/test_server_posix.cc b/net/test/test_server_posix.cc index 3455694..2efc54f 100644 --- a/net/test/test_server_posix.cc +++ b/net/test/test_server_posix.cc @@ -125,7 +125,7 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) { base::LaunchOptions options; options.fds_to_remap = &map_write_fd; if (!base::LaunchProcess(python_command, options, &process_handle_)) { - LOG(ERROR) << "Failed to launch " << python_command.command_line_string(); + LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); return false; } diff --git a/net/test/test_server_win.cc b/net/test/test_server_win.cc index 96c899e..b01da32 100644 --- a/net/test/test_server_win.cc +++ b/net/test/test_server_win.cc @@ -38,7 +38,7 @@ bool LaunchTestServerAsJob(const CommandLine& cmdline, // automatically associated with a job object created by the debugger. // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. if (!CreateProcess( - NULL, const_cast<wchar_t*>(cmdline.command_line_string().c_str()), + NULL, const_cast<wchar_t*>(cmdline.GetCommandLineString().c_str()), NULL, NULL, TRUE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &startup_info, &process_info)) { LOG(ERROR) << "Could not create process."; @@ -183,7 +183,7 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) { true, &process_handle_, &job_handle_)) { - LOG(ERROR) << "Failed to launch " << python_command.command_line_string(); + LOG(ERROR) << "Failed to launch " << python_command.GetCommandLineString(); return false; } diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc index ee5a50e..59b85f8 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; } |