diff options
author | pauljensen <pauljensen@chromium.org> | 2015-09-01 06:19:45 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-01 13:20:22 +0000 |
commit | 53197db553fa979bcdce9836f7346fa898d416fe (patch) | |
tree | 45fc8c8ce6ebc15797f8d66fd9d57081d654ec2a /mojo/services | |
parent | ab0a4acf8457c2d2abee609fbe5342093d43b244 (diff) | |
download | chromium_src-53197db553fa979bcdce9836f7346fa898d416fe.zip chromium_src-53197db553fa979bcdce9836f7346fa898d416fe.tar.gz chromium_src-53197db553fa979bcdce9836f7346fa898d416fe.tar.bz2 |
Make UrlRequestContextBuilder take scoped_ptr's when it takes ownership
UrlRequestContextBuilder was already taking ownership in most cases, so
it should be taking scoped_ptr's instead of raw pointers. This change
should help enforce proper ownership and has already identified two
ownership bugs. I'm fixing the ownership bugs (a double-free of
ProxyConfigService in Cronet and of NetLog in AwURLRequestContextGetter)
in this change also. I'm changing UrlRequestContextBuilder to not take
ownership of NetLog however as this conflicts with some other uses of
NetLog, like how it's exposed via ContentBrowserClient.
BUG=508553
TBR=jam
Review URL: https://codereview.chromium.org/1303493002
Cr-Commit-Position: refs/heads/master@{#346637}
Diffstat (limited to 'mojo/services')
-rw-r--r-- | mojo/services/network/network_context.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mojo/services/network/network_context.cc b/mojo/services/network/network_context.cc index 4e2bf55..3208ad7 100644 --- a/mojo/services/network/network_context.cc +++ b/mojo/services/network/network_context.cc @@ -168,13 +168,12 @@ scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext( new net::MappedHostResolver(host_resolver.Pass())); remapped_host_resolver->SetRulesFromString( command_line->GetSwitchValueASCII(kHostResolverRules)); - host_resolver.reset(remapped_host_resolver.release()); - builder.set_host_resolver(host_resolver.release()); + builder.set_host_resolver(remapped_host_resolver.Pass()); } builder.set_accept_language("en-us,en"); builder.set_user_agent(mojo::common::GetUserAgent()); - builder.set_proxy_service(net::ProxyService::CreateDirect()); + builder.set_proxy_service(make_scoped_ptr(net::ProxyService::CreateDirect())); builder.set_transport_security_persister_path(base_path); net::URLRequestContextBuilder::HttpCacheParams cache_params; @@ -210,7 +209,7 @@ scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext( new net::CookieMonster(cookie_store, nullptr), nullptr); } - return make_scoped_ptr(builder.Build()); + return builder.Build().Pass(); } } // namespace mojo |