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

Unified Diff: net/cookies/cookie_monster.cc

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: Fix includes Created 4 years, 10 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: net/cookies/cookie_monster.cc
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index e9eccd2c907f94a20025d4a5dc6925105db46d2c..0e78185e815d62fc9677918015612e0935f4d6ea 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -853,6 +853,7 @@ void CookieMonster::SetCookieWithDetailsAsync(
void CookieMonster::FlushStore(const base::Closure& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
+
if (initialized_ && store_.get())
store_->Flush(callback);
else if (!callback.is_null())
@@ -861,6 +862,7 @@ void CookieMonster::FlushStore(const base::Closure& callback) {
void CookieMonster::SetForceKeepSessionState() {
DCHECK(thread_checker_.CalledOnValidThread());
+
if (store_)
store_->SetForceKeepSessionState();
}
@@ -992,6 +994,7 @@ CookieMonster::AddCallbackForCookie(const GURL& gurl,
const std::string& name,
const CookieChangedCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
+
std::pair<GURL, std::string> key(gurl, name);
if (hook_map_.count(key) == 0)
hook_map_[key] = make_linked_ptr(new CookieChangedCallbackList());
@@ -1002,6 +1005,8 @@ CookieMonster::AddCallbackForCookie(const GURL& gurl,
CookieMonster::~CookieMonster() {
DCHECK(thread_checker_.CalledOnValidThread());
+ // TODO(mmenke): Does it really make sense to run |delegate_| and
+ // CookieChanged callbacks when the CookieStore is destroyed?
for (CookieMap::iterator cookie_it = cookies_.begin();
cookie_it != cookies_.end();) {
CookieMap::iterator current_cookie_it = cookie_it;

Powered by Google App Engine
This is Rietveld 408576698