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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 640353003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 global_host_resolver->SetDefaultAddressFamily( 213 global_host_resolver->SetDefaultAddressFamily(
214 net::ADDRESS_FAMILY_UNSPECIFIED); 214 net::ADDRESS_FAMILY_UNSPECIFIED);
215 } else if (command_line.HasSwitch(switches::kDisableIPv6)) { 215 } else if (command_line.HasSwitch(switches::kDisableIPv6)) {
216 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); 216 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
217 } 217 }
218 218
219 // If hostname remappings were specified on the command-line, layer these 219 // If hostname remappings were specified on the command-line, layer these
220 // rules on top of the real host resolver. This allows forwarding all requests 220 // rules on top of the real host resolver. This allows forwarding all requests
221 // through a designated test server. 221 // through a designated test server.
222 if (!command_line.HasSwitch(switches::kHostResolverRules)) 222 if (!command_line.HasSwitch(switches::kHostResolverRules))
223 return global_host_resolver.PassAs<net::HostResolver>(); 223 return global_host_resolver.Pass();
224 224
225 scoped_ptr<net::MappedHostResolver> remapped_resolver( 225 scoped_ptr<net::MappedHostResolver> remapped_resolver(
226 new net::MappedHostResolver(global_host_resolver.Pass())); 226 new net::MappedHostResolver(global_host_resolver.Pass()));
227 remapped_resolver->SetRulesFromString( 227 remapped_resolver->SetRulesFromString(
228 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); 228 command_line.GetSwitchValueASCII(switches::kHostResolverRules));
229 return remapped_resolver.PassAs<net::HostResolver>(); 229 return remapped_resolver.Pass();
230 } 230 }
231 231
232 // TODO(willchan): Remove proxy script fetcher context since it's not necessary 232 // TODO(willchan): Remove proxy script fetcher context since it's not necessary
233 // now that I got rid of refcounting URLRequestContexts. 233 // now that I got rid of refcounting URLRequestContexts.
234 // See IOThread::Globals for details. 234 // See IOThread::Globals for details.
235 net::URLRequestContext* 235 net::URLRequestContext*
236 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, 236 ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
237 net::NetLog* net_log) { 237 net::NetLog* net_log) {
238 net::URLRequestContext* context = new net::URLRequestContext; 238 net::URLRequestContext* context = new net::URLRequestContext;
239 context->set_net_log(net_log); 239 context->set_net_log(net_log);
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 GetTaskRunnerWithShutdownBehavior( 703 GetTaskRunnerWithShutdownBehavior(
704 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); 704 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)));
705 #if !defined(DISABLE_FTP_SUPPORT) 705 #if !defined(DISABLE_FTP_SUPPORT)
706 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( 706 globals_->proxy_script_fetcher_ftp_transaction_factory.reset(
707 new net::FtpNetworkLayer(globals_->host_resolver.get())); 707 new net::FtpNetworkLayer(globals_->host_resolver.get()));
708 job_factory->SetProtocolHandler( 708 job_factory->SetProtocolHandler(
709 url::kFtpScheme, 709 url::kFtpScheme,
710 new net::FtpProtocolHandler( 710 new net::FtpProtocolHandler(
711 globals_->proxy_script_fetcher_ftp_transaction_factory.get())); 711 globals_->proxy_script_fetcher_ftp_transaction_factory.get()));
712 #endif 712 #endif
713 globals_->proxy_script_fetcher_url_request_job_factory = 713 globals_->proxy_script_fetcher_url_request_job_factory = job_factory.Pass();
714 job_factory.PassAs<net::URLRequestJobFactory>();
715 714
716 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); 715 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager());
717 globals_->throttler_manager->set_net_log(net_log_); 716 globals_->throttler_manager->set_net_log(net_log_);
718 // Always done in production, disabled only for unit tests. 717 // Always done in production, disabled only for unit tests.
719 globals_->throttler_manager->set_enable_thread_checks(true); 718 globals_->throttler_manager->set_enable_thread_checks(true);
720 719
721 globals_->proxy_script_fetcher_context.reset( 720 globals_->proxy_script_fetcher_context.reset(
722 ConstructProxyScriptFetcherContext(globals_, net_log_)); 721 ConstructProxyScriptFetcherContext(globals_, net_log_));
723 722
724 #if defined(OS_MACOSX) && !defined(OS_IOS) 723 #if defined(OS_MACOSX) && !defined(OS_IOS)
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1411 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1413 for (size_t i = 0; i < supported_versions.size(); ++i) { 1412 for (size_t i = 0; i < supported_versions.size(); ++i) {
1414 net::QuicVersion version = supported_versions[i]; 1413 net::QuicVersion version = supported_versions[i];
1415 if (net::QuicVersionToString(version) == quic_version) { 1414 if (net::QuicVersionToString(version) == quic_version) {
1416 return version; 1415 return version;
1417 } 1416 }
1418 } 1417 }
1419 1418
1420 return net::QUIC_VERSION_UNSUPPORTED; 1419 return net::QUIC_VERSION_UNSUPPORTED;
1421 } 1420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698