Fix lifetime management of URLRequestContextGetter

I noticed this bug while adding persistent cookie storage.
This commit is contained in:
Adam Roben 2013-03-27 08:53:53 -04:00
parent 4fc0fed081
commit 90691e394f
2 changed files with 3 additions and 3 deletions

View file

@ -43,11 +43,11 @@ BrowserContext::~BrowserContext() {
net::URLRequestContextGetter* BrowserContext::CreateRequestContext(content::ProtocolHandlerMap* protocol_handlers) {
DCHECK(!url_request_getter_);
url_request_getter_.reset(new URLRequestContextGetter(
url_request_getter_ = new URLRequestContextGetter(
GetPath(),
content::BrowserThread::UnsafeGetMessageLoopForThread(content::BrowserThread::IO),
content::BrowserThread::UnsafeGetMessageLoopForThread(content::BrowserThread::FILE),
protocol_handlers));
protocol_handlers);
resource_context_->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get();
}

View file

@ -36,7 +36,7 @@ private:
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
scoped_ptr<ResourceContext> resource_context_;
scoped_ptr<URLRequestContextGetter> url_request_getter_;
scoped_refptr<URLRequestContextGetter> url_request_getter_;
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
};