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

Side by Side Diff: net/tools/dump_cache/dump_cache.cc

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 2 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/tools/dump_cache/url_to_filename_encoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/scoped_handle.h" 14 #include "base/scoped_handle.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h"
16 17
17 #include "net/disk_cache/disk_format.h" 18 #include "net/disk_cache/disk_format.h"
18 19
19 enum Errors { 20 enum Errors {
20 GENERIC = -1, 21 GENERIC = -1,
21 ALL_GOOD = 0, 22 ALL_GOOD = 0,
22 INVALID_ARGUMENT = 1, 23 INVALID_ARGUMENT = 1,
23 FILE_ACCESS_ERROR, 24 FILE_ACCESS_ERROR,
24 UNKNOWN_VERSION, 25 UNKNOWN_VERSION,
25 TOOL_NOT_FOUND, 26 TOOL_NOT_FOUND,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 std::wstring hacked_command_line = command_line.command_line_string(); 78 std::wstring hacked_command_line = command_line.command_line_string();
78 const std::wstring old_exe(L"dump_cache"); 79 const std::wstring old_exe(L"dump_cache");
79 size_t to_remove = hacked_command_line.find(old_exe); 80 size_t to_remove = hacked_command_line.find(old_exe);
80 hacked_command_line.erase(to_remove, old_exe.size()); 81 hacked_command_line.erase(to_remove, old_exe.size());
81 82
82 bool do_upgrade = command_line.HasSwitch(kUpgrade); 83 bool do_upgrade = command_line.HasSwitch(kUpgrade);
83 bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles); 84 bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles);
84 85
85 std::wstring new_program; 86 std::wstring new_program;
86 if (do_upgrade) 87 if (do_upgrade)
87 new_program = StringPrintf(L"%ls%d", L"dump_cache_", version); 88 new_program = base::StringPrintf(L"%ls%d", L"dump_cache_", version);
88 else 89 else
89 new_program = StringPrintf(L"dump_cache"); 90 new_program = base::StringPrintf(L"dump_cache");
90 91
91 hacked_command_line.insert(to_remove, new_program); 92 hacked_command_line.insert(to_remove, new_program);
92 93
93 CommandLine new_command_line = CommandLine::FromString(hacked_command_line); 94 CommandLine new_command_line = CommandLine::FromString(hacked_command_line);
94 95
95 if (do_upgrade || do_convert_to_text) 96 if (do_upgrade || do_convert_to_text)
96 new_command_line.AppendSwitch(kSlave); 97 new_command_line.AppendSwitch(kSlave);
97 98
98 // TODO(evanm): remove needless usage of wstring from here and elsewhere. 99 // TODO(evanm): remove needless usage of wstring from here and elsewhere.
99 new_command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number)); 100 new_command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 Sleep(500); 178 Sleep(500);
178 return ALL_GOOD; 179 return ALL_GOOD;
179 } 180 }
180 181
181 if (command_line.HasSwitch(kDumpContents)) 182 if (command_line.HasSwitch(kDumpContents))
182 return DumpContents(input_path); 183 return DumpContents(input_path);
183 if (command_line.HasSwitch(kDumpHeaders)) 184 if (command_line.HasSwitch(kDumpHeaders))
184 return DumpHeaders(input_path); 185 return DumpHeaders(input_path);
185 return Help(); 186 return Help();
186 } 187 }
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/tools/dump_cache/url_to_filename_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698