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

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

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
OLDNEW
1 // Copyright (c) 2010 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 #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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 usage(argv[0]); 126 usage(argv[0]);
127 int client_limit = 1; 127 int client_limit = 1;
128 if (parsed_command_line.HasSwitch("n")) 128 if (parsed_command_line.HasSwitch("n"))
129 StringToInt(parsed_command_line.GetSwitchValueASCII("n"), &client_limit); 129 StringToInt(parsed_command_line.GetSwitchValueASCII("n"), &client_limit);
130 bool use_cache = parsed_command_line.HasSwitch("use-cache"); 130 bool use_cache = parsed_command_line.HasSwitch("use-cache");
131 131
132 // Do work here. 132 // Do work here.
133 MessageLoop loop(MessageLoop::TYPE_IO); 133 MessageLoop loop(MessageLoop::TYPE_IO);
134 134
135 scoped_refptr<net::HostResolver> host_resolver( 135 scoped_refptr<net::HostResolver> host_resolver(
136 net::CreateSystemHostResolver(NULL)); 136 net::CreateSystemHostResolver());
137 137
138 scoped_refptr<net::ProxyService> proxy_service( 138 scoped_refptr<net::ProxyService> proxy_service(
139 net::ProxyService::CreateNull()); 139 net::ProxyService::CreateNull());
140 scoped_refptr<net::SSLConfigService> ssl_config_service( 140 scoped_refptr<net::SSLConfigService> ssl_config_service(
141 net::SSLConfigService::CreateSystemSSLConfigService()); 141 net::SSLConfigService::CreateSystemSSLConfigService());
142 net::HttpTransactionFactory* factory = NULL; 142 net::HttpTransactionFactory* factory = NULL;
143 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory( 143 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory(
144 net::HttpAuthHandlerFactory::CreateDefault()); 144 net::HttpAuthHandlerFactory::CreateDefault());
145 if (use_cache) { 145 if (use_cache) {
146 factory = new net::HttpCache(NULL, host_resolver, proxy_service, 146 factory = new net::HttpCache(host_resolver, proxy_service,
147 ssl_config_service, 147 ssl_config_service, http_auth_handler_factory.get(), NULL, NULL,
148 http_auth_handler_factory.get(), 148 net::HttpCache::DefaultBackend::InMemory(0));
149 NULL,
150 NULL,
151 net::HttpCache::DefaultBackend::InMemory(0));
152 } else { 149 } else {
153 factory = new net::HttpNetworkLayer( 150 factory = new net::HttpNetworkLayer(
154 net::ClientSocketFactory::GetDefaultFactory(), NULL, host_resolver, 151 net::ClientSocketFactory::GetDefaultFactory(), host_resolver,
155 proxy_service, ssl_config_service, http_auth_handler_factory.get(), 152 proxy_service, ssl_config_service, http_auth_handler_factory.get(),
156 NULL, 153 NULL, NULL);
157 NULL);
158 } 154 }
159 155
160 { 156 {
161 StatsCounterTimer driver_time("FetchClient.total_time"); 157 StatsCounterTimer driver_time("FetchClient.total_time");
162 StatsScope<StatsCounterTimer> scope(driver_time); 158 StatsScope<StatsCounterTimer> scope(driver_time);
163 159
164 Client** clients = new Client*[client_limit]; 160 Client** clients = new Client*[client_limit];
165 for (int i = 0; i < client_limit; i++) 161 for (int i = 0; i < client_limit; i++)
166 clients[i] = new Client(factory, url); 162 clients[i] = new Client(factory, url);
167 163
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 std::string name(table.GetRowName(index)); 196 std::string name(table.GetRowName(index));
201 if (name.length() > 0) { 197 if (name.length() > 0) {
202 int value = table.GetRowValue(index); 198 int value = table.GetRowValue(index);
203 printf("%s:\t%d\n", name.c_str(), value); 199 printf("%s:\t%d\n", name.c_str(), value);
204 } 200 }
205 } 201 }
206 printf("</stats>\n"); 202 printf("</stats>\n");
207 } 203 }
208 return 0; 204 return 0;
209 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698