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

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

Issue 165430: Reference count ProxyService.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Sync Created 11 years, 4 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/proxy/proxy_service_unittest.cc ('k') | net/url_request/url_request_context.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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue(L"n")), 124 StringToInt(WideToASCII(parsed_command_line.GetSwitchValue(L"n")),
125 &client_limit); 125 &client_limit);
126 bool use_cache = parsed_command_line.HasSwitch(L"use-cache"); 126 bool use_cache = parsed_command_line.HasSwitch(L"use-cache");
127 127
128 // Do work here. 128 // Do work here.
129 MessageLoop loop(MessageLoop::TYPE_IO); 129 MessageLoop loop(MessageLoop::TYPE_IO);
130 130
131 scoped_refptr<net::HostResolver> host_resolver( 131 scoped_refptr<net::HostResolver> host_resolver(
132 net::CreateSystemHostResolver()); 132 net::CreateSystemHostResolver());
133 133
134 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); 134 scoped_refptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull() );
135 net::HttpTransactionFactory* factory = NULL; 135 net::HttpTransactionFactory* factory = NULL;
136 if (use_cache) { 136 if (use_cache) {
137 factory = new net::HttpCache(host_resolver, proxy_service.get(), 0); 137 factory = new net::HttpCache(host_resolver, proxy_service, 0);
138 } else { 138 } else {
139 factory = new net::HttpNetworkLayer( 139 factory = new net::HttpNetworkLayer(
140 net::ClientSocketFactory::GetDefaultFactory(), host_resolver, 140 net::ClientSocketFactory::GetDefaultFactory(), host_resolver,
141 proxy_service.get()); 141 proxy_service);
142 } 142 }
143 143
144 { 144 {
145 StatsCounterTimer driver_time("FetchClient.total_time"); 145 StatsCounterTimer driver_time("FetchClient.total_time");
146 StatsScope<StatsCounterTimer> scope(driver_time); 146 StatsScope<StatsCounterTimer> scope(driver_time);
147 147
148 Client** clients = new Client*[client_limit]; 148 Client** clients = new Client*[client_limit];
149 for (int i = 0; i < client_limit; i++) 149 for (int i = 0; i < client_limit; i++)
150 clients[i] = new Client(factory, url); 150 clients[i] = new Client(factory, url);
151 151
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 std::string name(table.GetRowName(index)); 184 std::string name(table.GetRowName(index));
185 if (name.length() > 0) { 185 if (name.length() > 0) {
186 int value = table.GetRowValue(index); 186 int value = table.GetRowValue(index);
187 printf("%s:\t%d\n", name.c_str(), value); 187 printf("%s:\t%d\n", name.c_str(), value);
188 } 188 }
189 } 189 }
190 printf("</stats>\n"); 190 printf("</stats>\n");
191 } 191 }
192 return 0; 192 return 0;
193 } 193 }
OLDNEW
« no previous file with comments | « net/proxy/proxy_service_unittest.cc ('k') | net/url_request/url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698