Index: net/proxy/proxy_service.cc |
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
index 73ba0eec2a2d2bc57ba1927800a4cdeea824e9c9..f9275165b2e05b47e4d5c218f731460dd4343908 100644 |
--- a/net/proxy/proxy_service.cc |
+++ b/net/proxy/proxy_service.cc |
@@ -917,7 +917,7 @@ class ProxyService::PacRequest |
// ProxyService --------------------------------------------------------------- |
-ProxyService::ProxyService(ProxyConfigService* config_service, |
+ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, |
scoped_ptr<ProxyResolverFactory> resolver_factory, |
NetLog* net_log) |
: resolver_factory_(resolver_factory.Pass()), |
@@ -929,36 +929,36 @@ ProxyService::ProxyService(ProxyConfigService* config_service, |
quick_check_enabled_(true) { |
NetworkChangeNotifier::AddIPAddressObserver(this); |
NetworkChangeNotifier::AddDNSObserver(this); |
- ResetConfigService(config_service); |
+ ResetConfigService(config_service.Pass()); |
} |
// static |
ProxyService* ProxyService::CreateUsingSystemProxyResolver( |
- ProxyConfigService* proxy_config_service, |
+ scoped_ptr<ProxyConfigService> proxy_config_service, |
size_t num_pac_threads, |
NetLog* net_log) { |
DCHECK(proxy_config_service); |
if (!ProxyResolverFactoryForSystem::IsSupported()) { |
VLOG(1) << "PAC support disabled because there is no system implementation"; |
- return CreateWithoutProxyResolver(proxy_config_service, net_log); |
+ return CreateWithoutProxyResolver(proxy_config_service.Pass(), net_log); |
} |
if (num_pac_threads == 0) |
num_pac_threads = kDefaultNumPacThreads; |
return new ProxyService( |
- proxy_config_service, |
+ proxy_config_service.Pass(), |
make_scoped_ptr(new ProxyResolverFactoryForSystem(num_pac_threads)), |
net_log); |
} |
// static |
ProxyService* ProxyService::CreateWithoutProxyResolver( |
- ProxyConfigService* proxy_config_service, |
+ scoped_ptr<ProxyConfigService> proxy_config_service, |
NetLog* net_log) { |
return new ProxyService( |
- proxy_config_service, |
+ proxy_config_service.Pass(), |
make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log); |
} |
@@ -966,8 +966,8 @@ ProxyService* ProxyService::CreateWithoutProxyResolver( |
ProxyService* ProxyService::CreateFixed(const ProxyConfig& pc) { |
// TODO(eroman): This isn't quite right, won't work if |pc| specifies |
// a PAC script. |
- return CreateUsingSystemProxyResolver(new ProxyConfigServiceFixed(pc), |
- 0, NULL); |
+ return CreateUsingSystemProxyResolver( |
+ make_scoped_ptr(new ProxyConfigServiceFixed(pc)).Pass(), 0, NULL); |
} |
// static |
@@ -985,7 +985,7 @@ ProxyService* ProxyService::CreateDirect() { |
ProxyService* ProxyService::CreateDirectWithNetLog(NetLog* net_log) { |
// Use direct connections. |
return new ProxyService( |
- new ProxyConfigServiceDirect, |
+ make_scoped_ptr(new ProxyConfigServiceDirect).Pass(), |
Randy Smith (Not in Mondays)
2015/08/24 21:58:19
As you can see from the line underneath, you don't
|
make_scoped_ptr(new ProxyResolverFactoryForNullResolver), net_log); |
} |
@@ -999,7 +999,7 @@ ProxyService* ProxyService::CreateFixedFromPacResult( |
new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); |
return new ProxyService( |
- proxy_config_service.release(), |
+ proxy_config_service.Pass(), |
make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL); |
} |
@@ -1473,7 +1473,7 @@ ProxyService::State ProxyService::ResetProxyConfig(bool reset_fetched_config) { |
} |
void ProxyService::ResetConfigService( |
- ProxyConfigService* new_proxy_config_service) { |
+ scoped_ptr<ProxyConfigService> new_proxy_config_service) { |
DCHECK(CalledOnValidThread()); |
State previous_state = ResetProxyConfig(true); |
@@ -1482,7 +1482,7 @@ void ProxyService::ResetConfigService( |
config_service_->RemoveObserver(this); |
// Set the new configuration service. |
- config_service_.reset(new_proxy_config_service); |
+ config_service_ = new_proxy_config_service.Pass(); |
config_service_->AddObserver(this); |
if (previous_state != STATE_NONE) |
@@ -1496,23 +1496,23 @@ void ProxyService::ForceReloadProxyConfig() { |
} |
// static |
-ProxyConfigService* ProxyService::CreateSystemProxyConfigService( |
+scoped_ptr<ProxyConfigService> ProxyService::CreateSystemProxyConfigService( |
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) { |
#if defined(OS_WIN) |
- return new ProxyConfigServiceWin(); |
+ return make_scoped_ptr(new ProxyConfigServiceWin()).Pass(); |
#elif defined(OS_IOS) |
- return new ProxyConfigServiceIOS(); |
+ return make_scoped_ptr(new ProxyConfigServiceIOS()).Pass(); |
#elif defined(OS_MACOSX) |
- return new ProxyConfigServiceMac(io_task_runner); |
+ return make_scoped_ptr(new ProxyConfigServiceMac(io_task_runner)).Pass(); |
#elif defined(OS_CHROMEOS) |
LOG(ERROR) << "ProxyConfigService for ChromeOS should be created in " |
<< "profile_io_data.cc::CreateProxyConfigService and this should " |
<< "be used only for examples."; |
- return new UnsetProxyConfigService; |
+ return make_scoped_ptr(new UnsetProxyConfigService).Pass(); |
#elif defined(OS_LINUX) |
- ProxyConfigServiceLinux* linux_config_service = |
- new ProxyConfigServiceLinux(); |
+ scoped_ptr<ProxyConfigServiceLinux> linux_config_service( |
+ new ProxyConfigServiceLinux()); |
// Assume we got called on the thread that runs the default glib |
// main loop, so the current thread is where we should be running |
@@ -1527,14 +1527,16 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService( |
linux_config_service->SetupAndFetchInitialConfig( |
glib_thread_task_runner, io_task_runner, file_task_runner); |
- return linux_config_service; |
+ return linux_config_service.Pass(); |
#elif defined(OS_ANDROID) |
- return new ProxyConfigServiceAndroid(io_task_runner, |
- base::ThreadTaskRunnerHandle::Get()); |
+ return make_scoped_ptr( |
+ new ProxyConfigServiceAndroid(io_task_runner, |
+ base::ThreadTaskRunnerHandle::Get())) |
+ .Pass(); |
#else |
LOG(WARNING) << "Failed to choose a system proxy settings fetcher " |
"for this platform."; |
- return new ProxyConfigServiceDirect(); |
+ return make_scoped_ptr(new ProxyConfigServiceDirect()).Pass(); |
#endif |
} |