Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1609)

Unified Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 197023: This CL changes the CookieStore obect to be a refcounted object to get a bett... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/chrome_url_request_context.cc
===================================================================
--- chrome/browser/net/chrome_url_request_context.cc (revision 25474)
+++ chrome/browser/net/chrome_url_request_context.cc (working copy)
@@ -155,10 +155,12 @@
// setup cookie store
if (!context->cookie_store_) {
DCHECK(!cookie_store_path.empty());
- context->cookie_db_.reset(new SQLitePersistentCookieStore(
- cookie_store_path.ToWStringHack(),
- g_browser_process->db_thread()->message_loop()));
- context->cookie_store_ = new net::CookieMonster(context->cookie_db_.get());
+
+ scoped_refptr<SQLitePersistentCookieStore> cookie_db =
+ new SQLitePersistentCookieStore(
+ cookie_store_path.ToWStringHack(),
+ g_browser_process->db_thread()->message_loop());
+ context->cookie_store_ = new net::CookieMonster(cookie_db.get());
}
return context;
@@ -180,12 +182,13 @@
// All we care about for extensions is the cookie store.
DCHECK(!cookie_store_path.empty());
- context->cookie_db_.reset(new SQLitePersistentCookieStore(
- cookie_store_path.ToWStringHack(),
- g_browser_process->db_thread()->message_loop()));
- net::CookieMonster* cookie_monster = new net::CookieMonster(
- context->cookie_db_.get());
+ scoped_refptr<SQLitePersistentCookieStore> cookie_db =
+ new SQLitePersistentCookieStore(
+ cookie_store_path.ToWStringHack(),
+ g_browser_process->db_thread()->message_loop());
+ net::CookieMonster* cookie_monster = new net::CookieMonster(cookie_db.get());
+
// Enable cookies for extension URLs only.
const char* schemes[] = {chrome::kExtensionScheme};
cookie_monster->SetCookieableSchemes(schemes, 1);
@@ -542,14 +545,4 @@
delete ftp_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.
- // TODO(eroman): The lifetime expectation of cookie_store_ is not right.
- // The assumption here is that the original request context (which owns
- // cookie_store_) is going to outlive the media context (which uses it).
- // However based on the destruction order of profiles this is not true.
- // http://crbug.com/15289.
- if (!is_media_)
- delete cookie_store_;
}

Powered by Google App Engine
This is Rietveld 408576698