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

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: merge Created 4 years, 9 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
« no previous file with comments | « net/cookies/cookie_monster.h ('k') | net/cookies/cookie_monster_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_monster.cc
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index bbec7b018deec16e0f1de01685f837fff165deb4..eff98e329031ac88ba3ccde9bf7889656abca78d 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -863,6 +863,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())
@@ -871,6 +872,7 @@ void CookieMonster::FlushStore(const base::Closure& callback) {
void CookieMonster::SetForceKeepSessionState() {
DCHECK(thread_checker_.CalledOnValidThread());
+
if (store_)
store_->SetForceKeepSessionState();
}
@@ -1002,6 +1004,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());
@@ -1012,6 +1015,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;
« no previous file with comments | « net/cookies/cookie_monster.h ('k') | net/cookies/cookie_monster_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698