| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This command-line program dumps the contents of a set of cache files, either | 5 // This command-line program dumps the contents of a set of cache files, either |
| 6 // to stdout or to another set of cache files. | 6 // to stdout or to another set of cache files. |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 command_line.SetProgram(program); | 89 command_line.SetProgram(program); |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (do_upgrade || do_convert_to_text) | 92 if (do_upgrade || do_convert_to_text) |
| 93 command_line.AppendSwitch(kSlave); | 93 command_line.AppendSwitch(kSlave); |
| 94 | 94 |
| 95 command_line.AppendSwitchNative(kPipe, pipe_number); | 95 command_line.AppendSwitchNative(kPipe, pipe_number); |
| 96 if (!base::LaunchProcess(command_line, base::LaunchOptions(), NULL)) { | 96 if (!base::LaunchProcess(command_line, base::LaunchOptions(), NULL)) { |
| 97 printf("Unable to launch the needed version of this tool: %ls\n", | 97 printf("Unable to launch the needed version of this tool: %ls\n", |
| 98 command_line.GetProgram().value().c_str()); | 98 command_line.GetProgram().value().c_str()); |
| 99 printf(kUpgradeHelp); | 99 printf("%s", kUpgradeHelp); |
| 100 return TOOL_NOT_FOUND; | 100 return TOOL_NOT_FOUND; |
| 101 } | 101 } |
| 102 return ALL_GOOD; | 102 return ALL_GOOD; |
| 103 } | 103 } |
| 104 | 104 |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 // ----------------------------------------------------------------------- | 107 // ----------------------------------------------------------------------- |
| 108 | 108 |
| 109 int main(int argc, const char* argv[]) { | 109 int main(int argc, const char* argv[]) { |
| 110 // Setup an AtExitManager so Singleton objects will be destroyed. | 110 // Setup an AtExitManager so Singleton objects will be destroyed. |
| 111 base::AtExitManager at_exit_manager; | 111 base::AtExitManager at_exit_manager; |
| 112 | 112 |
| 113 CommandLine::Init(argc, argv); | 113 base::CommandLine::Init(argc, argv); |
| 114 | 114 |
| 115 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 115 const base::CommandLine& command_line = |
| 116 *base::CommandLine::ForCurrentProcess(); |
| 116 base::FilePath input_path = command_line.GetSwitchValuePath(kInputPath); | 117 base::FilePath input_path = command_line.GetSwitchValuePath(kInputPath); |
| 117 if (input_path.empty()) | 118 if (input_path.empty()) |
| 118 return Help(); | 119 return Help(); |
| 119 | 120 |
| 120 bool dump_to_files = command_line.HasSwitch(kDumpToFiles); | 121 bool dump_to_files = command_line.HasSwitch(kDumpToFiles); |
| 121 bool upgrade = command_line.HasSwitch(kUpgrade); | 122 bool upgrade = command_line.HasSwitch(kUpgrade); |
| 122 | 123 |
| 123 base::FilePath output_path = command_line.GetSwitchValuePath(kOutputPath); | 124 base::FilePath output_path = command_line.GetSwitchValuePath(kOutputPath); |
| 124 if ((dump_to_files || upgrade) && output_path.empty()) | 125 if ((dump_to_files || upgrade) && output_path.empty()) |
| 125 return Help(); | 126 return Help(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 179 } |
| 179 | 180 |
| 180 if (command_line.HasSwitch(kDumpContents)) | 181 if (command_line.HasSwitch(kDumpContents)) |
| 181 return DumpContents(input_path); | 182 return DumpContents(input_path); |
| 182 | 183 |
| 183 if (command_line.HasSwitch(kDumpHeaders)) | 184 if (command_line.HasSwitch(kDumpHeaders)) |
| 184 return DumpHeaders(input_path); | 185 return DumpHeaders(input_path); |
| 185 | 186 |
| 186 return Help(); | 187 return Help(); |
| 187 } | 188 } |
| OLD | NEW |