summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-13 04:52:01 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-13 04:52:01 +0000
commitdb8f44cb41f402a9145bace60f6097410f46881d (patch)
treee1a403ae9c38a7b5671133185ddc1ac936a89edf /chrome/browser/profile.cc
parentd49801990067e7fe9a3caf141f31c6e6ba58fcfc (diff)
downloadchromium_src-db8f44cb41f402a9145bace60f6097410f46881d.zip
chromium_src-db8f44cb41f402a9145bace60f6097410f46881d.tar.gz
chromium_src-db8f44cb41f402a9145bace60f6097410f46881d.tar.bz2
Reverting 6966.
this failed UI tests catastrophically Review URL: http://codereview.chromium.org/14103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r--chrome/browser/profile.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 8cd01f8..d8f2f64 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -110,6 +110,7 @@ class ProfileImpl::RequestContext : public URLRequestContext,
const std::wstring& disk_cache_path,
PrefService* prefs)
: prefs_(prefs) {
+ cookie_store_ = NULL;
// setup user agent
user_agent_ = webkit_glue::GetUserAgent();
@@ -134,18 +135,18 @@ class ProfileImpl::RequestContext : public URLRequestContext,
if (record_mode || playback_mode) {
// Don't use existing cookies and use an in-memory store.
- cookie_store_.reset(new net::CookieMonster());
+ cookie_store_ = new net::CookieMonster();
cache->set_mode(
record_mode ? net::HttpCache::RECORD : net::HttpCache::PLAYBACK);
}
- http_transaction_factory_.reset(cache);
+ http_transaction_factory_ = cache;
// setup cookie store
- if (!cookie_store_.get()) {
+ if (!cookie_store_) {
DCHECK(!cookie_store_path.empty());
cookie_db_.reset(new SQLitePersistentCookieStore(
cookie_store_path, g_browser_process->db_thread()->message_loop()));
- cookie_store_.reset(new net::CookieMonster(cookie_db_.get()));
+ cookie_store_ = new net::CookieMonster(cookie_db_.get());
}
cookie_policy_.SetType(net::CookiePolicy::FromInt(
@@ -215,6 +216,10 @@ class ProfileImpl::RequestContext : public URLRequestContext,
virtual ~RequestContext() {
DCHECK(NULL == prefs_);
+ delete cookie_store_;
+ delete http_transaction_factory_;
+ delete proxy_service_;
+
if (default_request_context_ == this)
default_request_context_ = NULL;
}
@@ -249,12 +254,13 @@ class OffTheRecordRequestContext : public URLRequestContext,
// context to make sure it doesn't go away when we delete the object graph.
original_context_ = profile->GetRequestContext();
- // Share the same proxy service as the original profile (adds a reference).
+ // Share the same proxy service as the original profile. This proxy
+ // service's lifespan is dependent on the lifespan of the original profile,
+ // which we reference (see above).
proxy_service_ = original_context_->proxy_service();
- http_transaction_factory_.reset(
- new net::HttpCache(proxy_service_, 0));
- cookie_store_.reset(new net::CookieMonster);
+ http_transaction_factory_ = new net::HttpCache(proxy_service_, 0);
+ cookie_store_ = new net::CookieMonster;
cookie_policy_.SetType(net::CookiePolicy::FromInt(
prefs_->GetInteger(prefs::kCookieBehavior)));
user_agent_ = original_context_->user_agent();
@@ -320,6 +326,10 @@ class OffTheRecordRequestContext : public URLRequestContext,
virtual ~OffTheRecordRequestContext() {
DCHECK(NULL == prefs_);
+ delete cookie_store_;
+ delete http_transaction_factory_;
+ // NOTE: do not delete |proxy_service_| as is owned by the original profile.
+
// The OffTheRecordRequestContext simply act as a proxy to the real context.
// There is nothing else to delete.
}