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

Side by Side Diff: net/url_request/url_request_context_builder.cc

Issue 1301333002: make ProxyService::CreateSystemProxyConfigService return scoped_ptrs NOT FOR REVIEW (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: non linux builds Created 5 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
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 "net/url_request/url_request_context_builder.h" 5 #include "net/url_request/url_request_context_builder.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 if (!host_resolver_) { 275 if (!host_resolver_) {
276 host_resolver_ = HostResolver::CreateDefaultResolver(context->net_log()); 276 host_resolver_ = HostResolver::CreateDefaultResolver(context->net_log());
277 } 277 }
278 storage->set_host_resolver(host_resolver_.Pass()); 278 storage->set_host_resolver(host_resolver_.Pass());
279 279
280 if (!proxy_service_) { 280 if (!proxy_service_) {
281 // TODO(willchan): Switch to using this code when 281 // TODO(willchan): Switch to using this code when
282 // ProxyService::CreateSystemProxyConfigService()'s signature doesn't suck. 282 // ProxyService::CreateSystemProxyConfigService()'s signature doesn't suck.
283 #if defined(OS_LINUX) || defined(OS_ANDROID) 283 #if defined(OS_LINUX) || defined(OS_ANDROID)
284 ProxyConfigService* proxy_config_service = proxy_config_service_.release(); 284 scoped_ptr<ProxyConfigService> proxy_config_service(
285 proxy_config_service_.release());
Randy Smith (Not in Mondays) 2015/08/24 21:58:19 I think that .Pass() would be more idiomatic here
285 #else 286 #else
286 ProxyConfigService* proxy_config_service = NULL; 287 scoped_ptr<ProxyConfigService> proxy_config_service;
287 if (proxy_config_service_) { 288 if (proxy_config_service_) {
288 proxy_config_service = proxy_config_service_.release(); 289 proxy_config_service.reset(proxy_config_service_.release());
Randy Smith (Not in Mondays) 2015/08/24 21:58:19 Why not "proxy_config_service = proxy_config_servi
289 } else { 290 } else {
290 proxy_config_service = ProxyService::CreateSystemProxyConfigService( 291 proxy_config_service = ProxyService::CreateSystemProxyConfigService(
291 base::ThreadTaskRunnerHandle::Get().get(), 292 base::ThreadTaskRunnerHandle::Get().get(),
292 context->GetFileTaskRunner()); 293 context->GetFileTaskRunner());
293 } 294 }
294 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 295 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
295 proxy_service_.reset( 296 proxy_service_.reset(ProxyService::CreateUsingSystemProxyResolver(
296 ProxyService::CreateUsingSystemProxyResolver( 297 proxy_config_service.Pass(),
297 proxy_config_service, 298 0, // This results in using the default value.
298 0, // This results in using the default value. 299 context->net_log()));
299 context->net_log()));
300 } 300 }
301 storage->set_proxy_service(proxy_service_.release()); 301 storage->set_proxy_service(proxy_service_.release());
302 302
303 storage->set_ssl_config_service(new SSLConfigServiceDefaults); 303 storage->set_ssl_config_service(new SSLConfigServiceDefaults);
304 HttpAuthHandlerRegistryFactory* http_auth_handler_registry_factory = 304 HttpAuthHandlerRegistryFactory* http_auth_handler_registry_factory =
305 HttpAuthHandlerRegistryFactory::CreateDefault(context->host_resolver()); 305 HttpAuthHandlerRegistryFactory::CreateDefault(context->host_resolver());
306 for (size_t i = 0; i < extra_http_auth_handlers_.size(); ++i) { 306 for (size_t i = 0; i < extra_http_auth_handlers_.size(); ++i) {
307 http_auth_handler_registry_factory->RegisterSchemeFactory( 307 http_auth_handler_registry_factory->RegisterSchemeFactory(
308 extra_http_auth_handlers_[i].scheme, 308 extra_http_auth_handlers_[i].scheme,
309 extra_http_auth_handlers_[i].factory); 309 extra_http_auth_handlers_[i].factory);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 441 }
442 url_request_interceptors_.weak_clear(); 442 url_request_interceptors_.weak_clear();
443 } 443 }
444 storage->set_job_factory(top_job_factory.release()); 444 storage->set_job_factory(top_job_factory.release());
445 // TODO(willchan): Support sdch. 445 // TODO(willchan): Support sdch.
446 446
447 return context; 447 return context;
448 } 448 }
449 449
450 } // namespace net 450 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698