| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 Singleton<Driver> driver_; | 113 Singleton<Driver> driver_; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 int main(int argc, char**argv) { | 116 int main(int argc, char**argv) { |
| 117 base::AtExitManager exit; | 117 base::AtExitManager exit; |
| 118 StatsTable table("fetchclient", 50, 1000); | 118 StatsTable table("fetchclient", 50, 1000); |
| 119 table.set_current(&table); | 119 table.set_current(&table); |
| 120 | 120 |
| 121 CommandLine::Init(argc, argv); | 121 CommandLine::Init(argc, argv); |
| 122 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 122 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 123 std::string url = WideToASCII(parsed_command_line.GetSwitchValue("url")); | 123 std::string url = parsed_command_line.GetSwitchValueASCII("url"); |
| 124 if (!url.length()) | 124 if (!url.length()) |
| 125 usage(argv[0]); | 125 usage(argv[0]); |
| 126 int client_limit = 1; | 126 int client_limit = 1; |
| 127 if (parsed_command_line.HasSwitch("n")) | 127 if (parsed_command_line.HasSwitch("n")) |
| 128 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue("n")), | 128 StringToInt(parsed_command_line.GetSwitchValueASCII("n"), &client_limit); |
| 129 &client_limit); | |
| 130 bool use_cache = parsed_command_line.HasSwitch("use-cache"); | 129 bool use_cache = parsed_command_line.HasSwitch("use-cache"); |
| 131 | 130 |
| 132 // Do work here. | 131 // Do work here. |
| 133 MessageLoop loop(MessageLoop::TYPE_IO); | 132 MessageLoop loop(MessageLoop::TYPE_IO); |
| 134 | 133 |
| 135 scoped_refptr<net::HostResolver> host_resolver( | 134 scoped_refptr<net::HostResolver> host_resolver( |
| 136 net::CreateSystemHostResolver()); | 135 net::CreateSystemHostResolver()); |
| 137 | 136 |
| 138 scoped_refptr<net::ProxyService> proxy_service( | 137 scoped_refptr<net::ProxyService> proxy_service( |
| 139 net::ProxyService::CreateNull()); | 138 net::ProxyService::CreateNull()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 std::string name(table.GetRowName(index)); | 191 std::string name(table.GetRowName(index)); |
| 193 if (name.length() > 0) { | 192 if (name.length() > 0) { |
| 194 int value = table.GetRowValue(index); | 193 int value = table.GetRowValue(index); |
| 195 printf("%s:\t%d\n", name.c_str(), value); | 194 printf("%s:\t%d\n", name.c_str(), value); |
| 196 } | 195 } |
| 197 } | 196 } |
| 198 printf("</stats>\n"); | 197 printf("</stats>\n"); |
| 199 } | 198 } |
| 200 return 0; | 199 return 0; |
| 201 } | 200 } |
| OLD | NEW |