summaryrefslogtreecommitdiffstats
path: root/net/base/cookie_monster.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-16 01:05:46 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-16 01:05:46 +0000
commitb30a3f5c4fc1e62eaffa8db57bc5681665df3643 (patch)
treeb5703b6ef2d6e879473861f0d85252f813144749 /net/base/cookie_monster.cc
parentfe62fc852bd3c1c162ee1f41992096f59387dc31 (diff)
downloadchromium_src-b30a3f5c4fc1e62eaffa8db57bc5681665df3643.zip
chromium_src-b30a3f5c4fc1e62eaffa8db57bc5681665df3643.tar.gz
chromium_src-b30a3f5c4fc1e62eaffa8db57bc5681665df3643.tar.bz2
Convert LOG(INFO) to VLOG(1) - net/.
Also converts COOKIE_DLOG (since VLOG can be toggled on a granular basis), removes some unneeded "endl"s and {}s, aligns "<<"s per style guide, and changes KeygenHandler::GenKeyAndSignChallenge() to avoid using "goto". BUG=none TEST=none Review URL: http://codereview.chromium.org/3846001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_monster.cc')
-rw-r--r--net/base/cookie_monster.cc39
1 files changed, 15 insertions, 24 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 455a739..1e3b2d9 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -59,13 +59,6 @@
#include "net/base/net_util.h"
#include "net/base/registry_controlled_domain.h"
-// #define COOKIE_LOGGING_ENABLED
-#ifdef COOKIE_LOGGING_ENABLED
-#define COOKIE_DLOG(severity) DLOG_IF(INFO, 1)
-#else
-#define COOKIE_DLOG(severity) DLOG_IF(INFO, 0)
-#endif
-
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
@@ -731,7 +724,7 @@ bool CookieMonster::HasCookieableScheme(const GURL& url) {
}
// The scheme didn't match any in our whitelist.
- COOKIE_DLOG(WARNING) << "Unsupported cookie scheme: " << url.scheme();
+ DVLOG(1) << "WARNING: Unsupported cookie scheme: " << url.scheme();
return false;
}
@@ -754,7 +747,7 @@ bool CookieMonster::SetCookieWithCreationTimeAndOptions(
const CookieOptions& options) {
lock_.AssertAcquired();
- COOKIE_DLOG(INFO) << "SetCookie() line: " << cookie_line;
+ DVLOG(1) << "SetCookie() line: " << cookie_line;
Time creation_time = creation_time_or_null;
if (creation_time.is_null()) {
@@ -766,12 +759,12 @@ bool CookieMonster::SetCookieWithCreationTimeAndOptions(
ParsedCookie pc(cookie_line);
if (!pc.IsValid()) {
- COOKIE_DLOG(WARNING) << "Couldn't parse cookie";
+ DVLOG(1) << "WARNING: Couldn't parse cookie";
return false;
}
if (options.exclude_httponly() && pc.IsHttpOnly()) {
- COOKIE_DLOG(INFO) << "SetCookie() not setting httponly cookie";
+ DVLOG(1) << "SetCookie() not setting httponly cookie";
return false;
}
@@ -792,7 +785,7 @@ bool CookieMonster::SetCookieWithCreationTimeAndOptions(
!cookie_expires.is_null(), cookie_expires));
if (!cc.get()) {
- COOKIE_DLOG(WARNING) << "Failed to allocate CanonicalCookie";
+ DVLOG(1) << "WARNING: Failed to allocate CanonicalCookie";
return false;
}
return SetCanonicalCookie(&cc, creation_time, options);
@@ -846,12 +839,11 @@ bool CookieMonster::SetCanonicalCookie(scoped_ptr<CanonicalCookie>* cc,
const CookieOptions& options) {
const std::string key(GetKey((*cc)->Domain()));
if (DeleteAnyEquivalentCookie(key, **cc, options.exclude_httponly())) {
- COOKIE_DLOG(INFO) << "SetCookie() not clobbering httponly cookie";
+ DVLOG(1) << "SetCookie() not clobbering httponly cookie";
return false;
}
- COOKIE_DLOG(INFO) << "SetCookie() key: " << key
- << " cc: " << (*cc)->DebugString();
+ DVLOG(1) << "SetCookie() key: " << key << " cc: " << (*cc)->DebugString();
// Realize that we might be setting an expired cookie, and the only point
// was to delete the cookie which we've already done.
@@ -914,7 +906,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it,
histogram_cookie_deletion_cause_->Add(deletion_cause);
CanonicalCookie* cc = it->second;
- COOKIE_DLOG(INFO) << "InternalDeleteCookie() cc: " << cc->DebugString();
+ DVLOG(1) << "InternalDeleteCookie() cc: " << cc->DebugString();
if (cc->IsPersistent() && store_ && sync_to_store)
store_->DeleteCookie(*cc);
@@ -981,7 +973,7 @@ static bool FindLeastRecentlyAccessed(
std::vector<CookieMonster::CookieMap::iterator>* cookie_its) {
DCHECK_LE(num_purge, num_max);
if (cookie_its->size() > num_max) {
- COOKIE_DLOG(INFO) << "FindLeastRecentlyAccessed() Deep Garbage Collect.";
+ DVLOG(1) << "FindLeastRecentlyAccessed() Deep Garbage Collect.";
num_purge += cookie_its->size() - num_max;
DCHECK_GT(cookie_its->size(), num_purge);
@@ -1027,7 +1019,7 @@ int CookieMonster::GarbageCollect(const Time& current,
// Collect garbage for this key.
if (cookies_.count(key) > kDomainMaxCookies) {
- COOKIE_DLOG(INFO) << "GarbageCollect() key: " << key;
+ DVLOG(1) << "GarbageCollect() key: " << key;
std::vector<CookieMap::iterator> cookie_its;
num_deleted += GarbageCollectExpired(
@@ -1063,7 +1055,7 @@ int CookieMonster::GarbageCollect(const Time& current,
(expiry_and_key_scheme_ == EKS_DISCARD_RECENT_AND_PURGE_DOMAIN ||
earliest_access_time_ <
Time::Now() - TimeDelta::FromDays(kSafeFromGlobalPurgeDays))) {
- COOKIE_DLOG(INFO) << "GarbageCollect() everything";
+ DVLOG(1) << "GarbageCollect() everything";
std::vector<CookieMap::iterator> cookie_its;
base::Time oldest_left;
num_deleted += GarbageCollectExpired(
@@ -1266,7 +1258,7 @@ std::string CookieMonster::GetCookiesWithOptions(const GURL& url,
histogram_time_get_->AddTime(TimeTicks::Now() - start_time);
- COOKIE_DLOG(INFO) << "GetCookies() result: " << cookie_line;
+ DVLOG(1) << "GetCookies() result: " << cookie_line;
return cookie_line;
}
@@ -1504,9 +1496,8 @@ void CookieMonster::RecordPeriodicStats(const base::Time& current_time) {
it_key = its_cookies.second;
}
- DLOG(INFO) << "Time for recording cookie stats (us): "
- << (TimeTicks::Now() - beginning_of_time).InMicroseconds()
- << std::endl;
+ DVLOG(1) << "Time for recording cookie stats (us): "
+ << (TimeTicks::Now() - beginning_of_time).InMicroseconds();
last_statistic_record_time_ = current_time;
}
@@ -1521,7 +1512,7 @@ CookieMonster::ParsedCookie::ParsedCookie(const std::string& cookie_line)
httponly_index_(0) {
if (cookie_line.size() > kMaxCookieSize) {
- LOG(INFO) << "Not parsing cookie, too large: " << cookie_line.size();
+ VLOG(1) << "Not parsing cookie, too large: " << cookie_line.size();
return;
}