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

Side by Side Diff: net/tools/fetch/fetch_client.cc

Issue 149511: Refactorings surrounding HostResolver:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Merge in socks5_client_socket_unittest.cc Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/tcp_pinger_unittest.cc ('k') | net/url_request/url_request_unittest.h » ('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) 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/singleton.h" 8 #include "base/singleton.h"
9 #include "base/stats_counters.h" 9 #include "base/stats_counters.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 usage(argv[0]); 120 usage(argv[0]);
121 int client_limit = 1; 121 int client_limit = 1;
122 if (parsed_command_line.HasSwitch(L"n")) 122 if (parsed_command_line.HasSwitch(L"n"))
123 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue(L"n")), 123 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue(L"n")),
124 &client_limit); 124 &client_limit);
125 bool use_cache = parsed_command_line.HasSwitch(L"use-cache"); 125 bool use_cache = parsed_command_line.HasSwitch(L"use-cache");
126 126
127 // Do work here. 127 // Do work here.
128 MessageLoop loop; 128 MessageLoop loop;
129 129
130 scoped_refptr<net::HostResolver> host_resolver(new net::HostResolver); 130 scoped_refptr<net::HostResolver> host_resolver(
131 net::CreateSystemHostResolver());
132
131 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); 133 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull());
132 net::HttpTransactionFactory* factory = NULL; 134 net::HttpTransactionFactory* factory = NULL;
133 if (use_cache) { 135 if (use_cache) {
134 factory = new net::HttpCache(host_resolver, proxy_service.get(), 0); 136 factory = new net::HttpCache(host_resolver, proxy_service.get(), 0);
135 } else { 137 } else {
136 factory = new net::HttpNetworkLayer( 138 factory = new net::HttpNetworkLayer(
137 net::ClientSocketFactory::GetDefaultFactory(), host_resolver, 139 net::ClientSocketFactory::GetDefaultFactory(), host_resolver,
138 proxy_service.get()); 140 proxy_service.get());
139 } 141 }
140 142
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::string name(table.GetRowName(index)); 183 std::string name(table.GetRowName(index));
182 if (name.length() > 0) { 184 if (name.length() > 0) {
183 int value = table.GetRowValue(index); 185 int value = table.GetRowValue(index);
184 printf("%s:\t%d\n", name.c_str(), value); 186 printf("%s:\t%d\n", name.c_str(), value);
185 } 187 }
186 } 188 }
187 printf("</stats>\n"); 189 printf("</stats>\n");
188 } 190 }
189 return 0; 191 return 0;
190 } 192 }
OLDNEW
« no previous file with comments | « net/socket/tcp_pinger_unittest.cc ('k') | net/url_request/url_request_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698