summaryrefslogtreecommitdiffstats
path: root/chromecast
diff options
context:
space:
mode:
authormmenke <mmenke@chromium.org>2016-03-07 10:20:55 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-07 18:22:19 +0000
commit606c59ca3b9bba3f4a7b1206cb6b1b3c0a8e2c9b (patch)
tree4fef8efb85d599bfa32b200be015f2dda8926f34 /chromecast
parent4020b942e7d03a0ecf916922566099a78be6cb4b (diff)
downloadchromium_src-606c59ca3b9bba3f4a7b1206cb6b1b3c0a8e2c9b.zip
chromium_src-606c59ca3b9bba3f4a7b1206cb6b1b3c0a8e2c9b.tar.gz
chromium_src-606c59ca3b9bba3f4a7b1206cb6b1b3c0a8e2c9b.tar.bz2
CookieStore: Remove reference counting.
This has caused a number of issues in the past, and having defined lifecycles for objects makes code easier to reason about and maintain. BUG=472744 TBR=alexclarke@chromium.org, creis@chromium.org Review URL: https://codereview.chromium.org/1701063002 Cr-Commit-Position: refs/heads/master@{#379588}
Diffstat (limited to 'chromecast')
-rw-r--r--chromecast/browser/url_request_context_factory.cc15
-rw-r--r--chromecast/browser/url_request_context_factory.h3
2 files changed, 9 insertions, 9 deletions
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc
index f935c23..808ccba 100644
--- a/chromecast/browser/url_request_context_factory.cc
+++ b/chromecast/browser/url_request_context_factory.cc
@@ -301,6 +301,8 @@ net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() {
system_transaction_factory_.reset(new net::HttpNetworkLayer(
new net::HttpNetworkSession(system_params)));
system_job_factory_.reset(new net::URLRequestJobFactoryImpl());
+ system_cookie_store_ =
+ content::CreateCookieStore(content::CookieStoreConfig());
net::URLRequestContext* system_context = new net::URLRequestContext();
system_context->set_host_resolver(host_resolver_.get());
@@ -319,8 +321,7 @@ net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() {
system_context->set_http_user_agent_settings(
http_user_agent_settings_.get());
system_context->set_job_factory(system_job_factory_.get());
- system_context->set_cookie_store(
- content::CreateCookieStore(content::CookieStoreConfig()));
+ system_context->set_cookie_store(system_cookie_store_.get());
system_context->set_network_delegate(system_network_delegate_.get());
system_context->set_net_log(net_log_);
return system_context;
@@ -368,12 +369,8 @@ net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext(
content::CookieStoreConfig cookie_config(
browser_context->GetPath().Append(kCookieStoreFile),
- content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES,
- NULL, NULL);
- cookie_config.background_task_runner =
- scoped_refptr<base::SequencedTaskRunner>();
- scoped_refptr<net::CookieStore> cookie_store =
- content::CreateCookieStore(cookie_config);
+ content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, nullptr, nullptr);
+ main_cookie_store_ = content::CreateCookieStore(cookie_config);
net::URLRequestContext* main_context = new net::URLRequestContext();
main_context->set_host_resolver(host_resolver_.get());
@@ -386,7 +383,7 @@ net::URLRequestContext* URLRequestContextFactory::CreateMainRequestContext(
http_auth_handler_factory_.get());
main_context->set_http_server_properties(
http_server_properties_->GetWeakPtr());
- main_context->set_cookie_store(cookie_store.get());
+ main_context->set_cookie_store(main_cookie_store_.get());
main_context->set_http_user_agent_settings(
http_user_agent_settings_.get());
diff --git a/chromecast/browser/url_request_context_factory.h b/chromecast/browser/url_request_context_factory.h
index c0d881d..31bbf14 100644
--- a/chromecast/browser/url_request_context_factory.h
+++ b/chromecast/browser/url_request_context_factory.h
@@ -9,6 +9,7 @@
#include "net/http/http_network_session.h"
namespace net {
+class CookieStore;
class HttpTransactionFactory;
class HttpUserAgentSettings;
class NetLog;
@@ -106,10 +107,12 @@ class URLRequestContextFactory {
scoped_ptr<net::HttpServerProperties> http_server_properties_;
scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_;
scoped_ptr<net::HttpTransactionFactory> system_transaction_factory_;
+ scoped_ptr<net::CookieStore> system_cookie_store_;
scoped_ptr<net::URLRequestJobFactory> system_job_factory_;
bool main_dependencies_initialized_;
scoped_ptr<net::HttpTransactionFactory> main_transaction_factory_;
+ scoped_ptr<net::CookieStore> main_cookie_store_;
scoped_ptr<net::URLRequestJobFactory> main_job_factory_;
bool media_dependencies_initialized_;