diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 01:06:17 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 01:06:17 +0000 |
commit | d87c7a5941b3cdd0bab6bdfbad9b62d8bebb03ec (patch) | |
tree | 3d3668d78164500358729b0c4d2e56eebb509b9a | |
parent | e0fcc5605cc7e64fc2b4f9e3c9db150a280e3007 (diff) | |
download | chromium_src-d87c7a5941b3cdd0bab6bdfbad9b62d8bebb03ec.zip chromium_src-d87c7a5941b3cdd0bab6bdfbad9b62d8bebb03ec.tar.gz chromium_src-d87c7a5941b3cdd0bab6bdfbad9b62d8bebb03ec.tar.bz2 |
Fix leak in ChromeURLRequestContext. I read the code wrong; we
always want to delete the cache instance.
Review URL: http://codereview.chromium.org/63138
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13399 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/net/chrome_url_request_context.cc | 11 | ||||
-rw-r--r-- | chrome/browser/net/chrome_url_request_context.h | 1 |
2 files changed, 2 insertions, 10 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 6d9dea8..521a40a 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -82,7 +82,6 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal( record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK); } context->http_transaction_factory_ = cache; - context->owns_http_transaction_factory_ = true; // The kNewFtp switch is Windows specific only because we have multiple FTP // implementations on Windows. @@ -126,7 +125,6 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord( context->http_transaction_factory_ = new net::HttpCache(context->proxy_service_, 0); - context->owns_http_transaction_factory_ = true; context->cookie_store_ = new net::CookieMonster; return context; @@ -171,13 +169,11 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateRequestContextForMedia( static_cast<net::HttpNetworkLayer*>(original_cache->network_layer()); cache = new net::HttpCache(original_network_layer->GetSession(), disk_cache_path.ToWStringHack(), 240000000); - context->owns_http_transaction_factory_ = false; } else { // If original HttpCache doesn't exist, simply construct one with a whole // new set of network stack. cache = new net::HttpCache(original_context->proxy_service(), disk_cache_path.ToWStringHack(), 240000000); - context->owns_http_transaction_factory_ = true; } // Set the cache type to media. @@ -194,8 +190,7 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateRequestContextForMedia( ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile) : prefs_(profile->GetPrefs()), is_media_(false), - is_off_the_record_(profile->IsOffTheRecord()), - owns_http_transaction_factory_(false) { + is_off_the_record_(profile->IsOffTheRecord()) { // Set up Accept-Language and Accept-Charset header values accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( WideToASCII(prefs_->GetString(prefs::kAcceptLanguages))); @@ -319,9 +314,7 @@ ChromeURLRequestContext::~ChromeURLRequestContext() { NotificationService::NoDetails()); delete ftp_transaction_factory_; - - if (owns_http_transaction_factory_) - delete http_transaction_factory_; + delete http_transaction_factory_; // Do not delete the cookie store in the case of the media context, as it is // owned by the original context. diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index 3419df59..34b3d97 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -95,5 +95,4 @@ class ChromeURLRequestContext : public URLRequestContext, PrefService* prefs_; bool is_media_; bool is_off_the_record_; - bool owns_http_transaction_factory_; }; |