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

Unified Diff: net/base/cookie_monster.cc

Issue 2756003: Make CookieMonster NonThreadSafe. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Address eroman's and cindylau's comments. Created 10 years, 6 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/base/cookie_monster.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/cookie_monster.cc
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index f74752a6e18b705822389bff9f9cb13a1501c69e..8ea97c02186c0435cb4fc9c08cd254103eea0cae 100755
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -549,6 +549,7 @@ bool CookieMonster::HasCookieableScheme(const GURL& url) {
void CookieMonster::SetCookieableSchemes(
const char* schemes[], size_t num_schemes) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
cookieable_schemes_.clear();
@@ -561,6 +562,7 @@ bool CookieMonster::SetCookieWithCreationTimeAndOptions(
const std::string& cookie_line,
const Time& creation_time_or_null,
const CookieOptions& options) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
if (!HasCookieableScheme(url)) {
@@ -616,6 +618,7 @@ bool CookieMonster::SetCookieWithDetails(
const GURL& url, const std::string& name, const std::string& value,
const std::string& domain, const std::string& path,
const base::Time& expiration_time, bool secure, bool http_only) {
+ DCHECK(CalledOnValidThread());
// Expect a valid domain attribute with no illegal characters.
std::string parsed_domain = ParsedCookie::ParseValueString(domain);
@@ -833,6 +836,7 @@ int CookieMonster::GarbageCollectExpired(
}
int CookieMonster::DeleteAll(bool sync_to_store) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -850,6 +854,7 @@ int CookieMonster::DeleteAll(bool sync_to_store) {
int CookieMonster::DeleteAllCreatedBetween(const Time& delete_begin,
const Time& delete_end,
bool sync_to_store) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -871,11 +876,13 @@ int CookieMonster::DeleteAllCreatedBetween(const Time& delete_begin,
int CookieMonster::DeleteAllCreatedAfter(const Time& delete_begin,
bool sync_to_store) {
+ DCHECK(CalledOnValidThread());
return DeleteAllCreatedBetween(delete_begin, Time(), sync_to_store);
}
int CookieMonster::DeleteAllForURL(const GURL& url,
bool sync_to_store) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -892,6 +899,7 @@ int CookieMonster::DeleteAllForURL(const GURL& url,
bool CookieMonster::DeleteCookie(const std::string& domain,
const CanonicalCookie& cookie,
bool sync_to_store) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -919,6 +927,7 @@ static bool CookieSorter(CookieMonster::CanonicalCookie* cc1,
bool CookieMonster::SetCookieWithOptions(const GURL& url,
const std::string& cookie_line,
const CookieOptions& options) {
+ DCHECK(CalledOnValidThread());
return SetCookieWithCreationTimeAndOptions(url, cookie_line, Time(), options);
}
@@ -936,6 +945,7 @@ bool CookieMonster::SetCookieWithOptions(const GURL& url,
// should be fast and simple enough for now.
std::string CookieMonster::GetCookiesWithOptions(const GURL& url,
const CookieOptions& options) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -968,6 +978,7 @@ std::string CookieMonster::GetCookiesWithOptions(const GURL& url,
void CookieMonster::DeleteCookie(const GURL& url,
const std::string& cookie_name) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -999,6 +1010,7 @@ void CookieMonster::DeleteCookie(const GURL& url,
}
CookieMonster::CookieList CookieMonster::GetAllCookies() {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
@@ -1022,6 +1034,7 @@ CookieMonster::CookieList CookieMonster::GetAllCookies() {
}
CookieMonster::CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) {
+ DCHECK(CalledOnValidThread());
AutoLock autolock(lock_);
InitIfNecessary();
« no previous file with comments | « net/base/cookie_monster.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698