summaryrefslogtreecommitdiffstats
path: root/remoting/base
diff options
context:
space:
mode:
authorpauljensen <pauljensen@chromium.org>2015-09-01 06:19:45 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-01 13:20:22 +0000
commit53197db553fa979bcdce9836f7346fa898d416fe (patch)
tree45fc8c8ce6ebc15797f8d66fd9d57081d654ec2a /remoting/base
parentab0a4acf8457c2d2abee609fbe5342093d43b244 (diff)
downloadchromium_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 'remoting/base')
-rw-r--r--remoting/base/url_request_context_getter.cc7
-rw-r--r--remoting/base/url_request_context_getter.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/remoting/base/url_request_context_getter.cc b/remoting/base/url_request_context_getter.cc
index 4c9c272..b527481 100644
--- a/remoting/base/url_request_context_getter.cc
+++ b/remoting/base/url_request_context_getter.cc
@@ -25,10 +25,11 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
if (!url_request_context_.get()) {
net::URLRequestContextBuilder builder;
builder.SetFileTaskRunner(file_task_runner_);
- builder.set_net_log(new VlogNetLog());
+ net_log_.reset(new VlogNetLog());
+ builder.set_net_log(net_log_.get());
builder.DisableHttpCache();
- builder.set_proxy_config_service(proxy_config_service_.release());
- url_request_context_.reset(builder.Build());
+ builder.set_proxy_config_service(proxy_config_service_.Pass());
+ url_request_context_ = builder.Build().Pass();
}
return url_request_context_.get();
}
diff --git a/remoting/base/url_request_context_getter.h b/remoting/base/url_request_context_getter.h
index e37b3a8..93e6817 100644
--- a/remoting/base/url_request_context_getter.h
+++ b/remoting/base/url_request_context_getter.h
@@ -14,6 +14,7 @@ class SingleThreadTaskRunner;
} // namespace base
namespace net {
+class NetLog;
class ProxyConfigService;
} // namespace net
@@ -37,6 +38,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
+ scoped_ptr<net::NetLog> net_log_;
scoped_ptr<net::URLRequestContext> url_request_context_;
DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);