diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 01:54:49 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 01:54:49 +0000 |
commit | 2ebdac9b2ea2f1c75393b0b49558dd9fcfebc0bb (patch) | |
tree | 7b8a401d7ad5cb823fc698d1efc573b784cf5e57 /net/tools | |
parent | c8140ab3e26f784c11e1ba5fe93fbc07dfe4cee7 (diff) | |
download | chromium_src-2ebdac9b2ea2f1c75393b0b49558dd9fcfebc0bb.zip chromium_src-2ebdac9b2ea2f1c75393b0b49558dd9fcfebc0bb.tar.gz chromium_src-2ebdac9b2ea2f1c75393b0b49558dd9fcfebc0bb.tar.bz2 |
Fix dump_cache build.
Review URL: http://codereview.chromium.org/18400
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r-- | net/tools/dump_cache/dump_cache.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc index 2aa3b56..da59821 100644 --- a/net/tools/dump_cache/dump_cache.cc +++ b/net/tools/dump_cache/dump_cache.cc @@ -67,20 +67,25 @@ int Help() { } // Starts a new process, to generate the files. -int LaunchSlave(const CommandLine &command_line, const std::wstring pipe_number, +int LaunchSlave(const CommandLine& command_line, const std::wstring pipe_number, int version) { - std::wstring new_command_line = command_line.command_line_string(); + // 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.exe"); - size_t to_remove = new_command_line.find(old_exe); - new_command_line.erase(to_remove, old_exe.size()); + size_t to_remove = hacked_command_line.find(old_exe); + hacked_command_line.erase(to_remove, old_exe.size()); std::wstring new_program = StringPrintf(L"%ls%d.exe", L"dump_cache_", version); - new_command_line.insert(to_remove, new_program); + hacked_command_line.insert(to_remove, new_program); + + CommandLine new_command_line(L""); + new_command_line.ParseFromString(hacked_command_line); + if (command_line.HasSwitch(kUpgrade)) - CommandLine::AppendSwitch(&new_command_line, kSlave); + new_command_line.AppendSwitch(kSlave); - CommandLine::AppendSwitchWithValue(&new_command_line, kPipe, pipe_number); + new_command_line.AppendSwitchWithValue(kPipe, pipe_number); if (!base::LaunchApp(new_command_line, false, false, NULL)) { printf("Unable to launch the needed version of this tool: %ls\n", new_program.c_str()); @@ -96,7 +101,9 @@ int main(int argc, const char* argv[]) { // Setup an AtExitManager so Singleton objects will be destroyed. base::AtExitManager at_exit_manager; - CommandLine command_line; + CommandLine::Init(argc, argv); + + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); std::wstring input_path = command_line.GetSwitchValue(kInputPath); if (input_path.empty()) return Help(); |