Commit 35d74c04 authored by Maks Orlovich's avatar Maks Orlovich Committed by Commit Bot

net/cookie: Don't include excessive --v logging in release builds.

Change-Id: Ib9e73eba4c94c79ea88f565817665cc3e7c17ecb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572580Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652174}
parent f8c5dd0d
...@@ -203,13 +203,14 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create( ...@@ -203,13 +203,14 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
ParsedCookie parsed_cookie(cookie_line); ParsedCookie parsed_cookie(cookie_line);
if (!parsed_cookie.IsValid()) { if (!parsed_cookie.IsValid()) {
VLOG(net::cookie_util::kVlogSetCookies) << "WARNING: Couldn't parse cookie"; DVLOG(net::cookie_util::kVlogSetCookies)
<< "WARNING: Couldn't parse cookie";
*status = CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE; *status = CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE;
return nullptr; return nullptr;
} }
if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) { if (options.exclude_httponly() && parsed_cookie.IsHttpOnly()) {
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "Create() is not creating a httponly cookie"; << "Create() is not creating a httponly cookie";
*status = CookieInclusionStatus::EXCLUDE_HTTP_ONLY; *status = CookieInclusionStatus::EXCLUDE_HTTP_ONLY;
return nullptr; return nullptr;
...@@ -217,7 +218,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create( ...@@ -217,7 +218,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
std::string cookie_domain; std::string cookie_domain;
if (!GetCookieDomain(url, parsed_cookie, &cookie_domain)) { if (!GetCookieDomain(url, parsed_cookie, &cookie_domain)) {
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "Create() failed to get a cookie domain"; << "Create() failed to get a cookie domain";
*status = CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN; *status = CookieInclusionStatus::EXCLUDE_INVALID_DOMAIN;
return nullptr; return nullptr;
...@@ -228,7 +229,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create( ...@@ -228,7 +229,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
// URL does not have a secure scheme, the cookie should be thrown away. // URL does not have a secure scheme, the cookie should be thrown away.
// https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone // https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone
if (parsed_cookie.IsSecure() && !url.SchemeIsCryptographic()) { if (parsed_cookie.IsSecure() && !url.SchemeIsCryptographic()) {
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "Create() is trying to create a secure cookie from an insecure URL"; << "Create() is trying to create a secure cookie from an insecure URL";
*status = CookieInclusionStatus::EXCLUDE_SECURE_ONLY; *status = CookieInclusionStatus::EXCLUDE_SECURE_ONLY;
return nullptr; return nullptr;
...@@ -250,7 +251,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create( ...@@ -250,7 +251,7 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
bool is_cookie_valid = IsCookiePrefixValid(prefix, url, parsed_cookie); bool is_cookie_valid = IsCookiePrefixValid(prefix, url, parsed_cookie);
RecordCookiePrefixMetrics(prefix, is_cookie_valid); RecordCookiePrefixMetrics(prefix, is_cookie_valid);
if (!is_cookie_valid) { if (!is_cookie_valid) {
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "Create() failed because the cookie violated prefix rules."; << "Create() failed because the cookie violated prefix rules.";
*status = CookieInclusionStatus::EXCLUDE_INVALID_PREFIX; *status = CookieInclusionStatus::EXCLUDE_INVALID_PREFIX;
return nullptr; return nullptr;
......
...@@ -689,7 +689,7 @@ void CookieMonster::SetCookieWithOptions(const GURL& url, ...@@ -689,7 +689,7 @@ void CookieMonster::SetCookieWithOptions(const GURL& url,
return; return;
} }
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "SetCookie() line: " << cookie_line; << "SetCookie() line: " << cookie_line;
CanonicalCookie::CookieInclusionStatus status; CanonicalCookie::CookieInclusionStatus status;
...@@ -699,7 +699,7 @@ void CookieMonster::SetCookieWithOptions(const GURL& url, ...@@ -699,7 +699,7 @@ void CookieMonster::SetCookieWithOptions(const GURL& url,
if (status != CanonicalCookie::CookieInclusionStatus::INCLUDE) { if (status != CanonicalCookie::CookieInclusionStatus::INCLUDE) {
DCHECK(!cc); DCHECK(!cc);
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "WARNING: Failed to allocate CanonicalCookie"; << "WARNING: Failed to allocate CanonicalCookie";
MaybeRunCookieCallback(std::move(callback), status); MaybeRunCookieCallback(std::move(callback), status);
return; return;
...@@ -1228,12 +1228,12 @@ void CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc, ...@@ -1228,12 +1228,12 @@ void CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc,
"SetCookie() not clobbering httponly cookie or secure cookie for " "SetCookie() not clobbering httponly cookie or secure cookie for "
"insecure scheme"; "insecure scheme";
VLOG(net::cookie_util::kVlogSetCookies) << error; DVLOG(net::cookie_util::kVlogSetCookies) << error;
MaybeRunCookieCallback(std::move(callback), status); MaybeRunCookieCallback(std::move(callback), status);
return; return;
} }
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "SetCookie() key: " << key << " cc: " << cc->DebugString(); << "SetCookie() key: " << key << " cc: " << cc->DebugString();
// Realize that we might be setting an expired cookie, and the only point // Realize that we might be setting an expired cookie, and the only point
...@@ -1266,7 +1266,7 @@ void CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc, ...@@ -1266,7 +1266,7 @@ void CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc,
InternalInsertCookie(key, std::move(cc), true); InternalInsertCookie(key, std::move(cc), true);
} else { } else {
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "SetCookie() not storing already expired cookie."; << "SetCookie() not storing already expired cookie.";
} }
...@@ -1345,7 +1345,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it, ...@@ -1345,7 +1345,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it,
"kChangeCauseMapping size should match DeletionCause size"); "kChangeCauseMapping size should match DeletionCause size");
CanonicalCookie* cc = it->second.get(); CanonicalCookie* cc = it->second.get();
VLOG(net::cookie_util::kVlogSetCookies) DVLOG(net::cookie_util::kVlogSetCookies)
<< "InternalDeleteCookie()" << "InternalDeleteCookie()"
<< ", cause:" << deletion_cause << ", cc: " << cc->DebugString(); << ", cause:" << deletion_cause << ", cc: " << cc->DebugString();
...@@ -1375,7 +1375,7 @@ size_t CookieMonster::GarbageCollect(const Time& current, ...@@ -1375,7 +1375,7 @@ size_t CookieMonster::GarbageCollect(const Time& current,
// Collect garbage for this key, minding cookie priorities. // Collect garbage for this key, minding cookie priorities.
if (cookies_.count(key) > kDomainMaxCookies) { if (cookies_.count(key) > kDomainMaxCookies) {
VLOG(net::cookie_util::kVlogGarbageCollection) DVLOG(net::cookie_util::kVlogGarbageCollection)
<< "GarbageCollect() key: " << key; << "GarbageCollect() key: " << key;
CookieItVector* cookie_its; CookieItVector* cookie_its;
...@@ -1386,7 +1386,7 @@ size_t CookieMonster::GarbageCollect(const Time& current, ...@@ -1386,7 +1386,7 @@ size_t CookieMonster::GarbageCollect(const Time& current,
GarbageCollectExpired(current, cookies_.equal_range(key), cookie_its); GarbageCollectExpired(current, cookies_.equal_range(key), cookie_its);
if (cookie_its->size() > kDomainMaxCookies) { if (cookie_its->size() > kDomainMaxCookies) {
VLOG(net::cookie_util::kVlogGarbageCollection) DVLOG(net::cookie_util::kVlogGarbageCollection)
<< "Deep Garbage Collect domain."; << "Deep Garbage Collect domain.";
size_t purge_goal = size_t purge_goal =
cookie_its->size() - (kDomainMaxCookies - kDomainPurgeCookies); cookie_its->size() - (kDomainMaxCookies - kDomainPurgeCookies);
...@@ -1465,7 +1465,7 @@ size_t CookieMonster::GarbageCollect(const Time& current, ...@@ -1465,7 +1465,7 @@ size_t CookieMonster::GarbageCollect(const Time& current,
// Collect garbage for everything. With firefox style we want to preserve // Collect garbage for everything. With firefox style we want to preserve
// cookies accessed in kSafeFromGlobalPurgeDays, otherwise evict. // cookies accessed in kSafeFromGlobalPurgeDays, otherwise evict.
if (cookies_.size() > kMaxCookies && earliest_access_time_ < safe_date) { if (cookies_.size() > kMaxCookies && earliest_access_time_ < safe_date) {
VLOG(net::cookie_util::kVlogGarbageCollection) DVLOG(net::cookie_util::kVlogGarbageCollection)
<< "GarbageCollect() everything"; << "GarbageCollect() everything";
CookieItVector cookie_its; CookieItVector cookie_its;
...@@ -1474,7 +1474,7 @@ size_t CookieMonster::GarbageCollect(const Time& current, ...@@ -1474,7 +1474,7 @@ size_t CookieMonster::GarbageCollect(const Time& current,
&cookie_its); &cookie_its);
if (cookie_its.size() > kMaxCookies) { if (cookie_its.size() > kMaxCookies) {
VLOG(net::cookie_util::kVlogGarbageCollection) DVLOG(net::cookie_util::kVlogGarbageCollection)
<< "Deep Garbage Collect everything."; << "Deep Garbage Collect everything.";
size_t purge_goal = cookie_its.size() - (kMaxCookies - kPurgeCookies); size_t purge_goal = cookie_its.size() - (kMaxCookies - kPurgeCookies);
DCHECK(purge_goal > kPurgeCookies); DCHECK(purge_goal > kPurgeCookies);
...@@ -1691,7 +1691,7 @@ bool CookieMonster::HasCookieableScheme(const GURL& url) { ...@@ -1691,7 +1691,7 @@ bool CookieMonster::HasCookieableScheme(const GURL& url) {
} }
// The scheme didn't match any in our whitelist. // The scheme didn't match any in our whitelist.
VLOG(net::cookie_util::kVlogPerCookieMonster) DVLOG(net::cookie_util::kVlogPerCookieMonster)
<< "WARNING: Unsupported cookie scheme: " << url.scheme(); << "WARNING: Unsupported cookie scheme: " << url.scheme();
return false; return false;
} }
......
...@@ -138,7 +138,7 @@ ParsedCookie::ParsedCookie(const std::string& cookie_line) ...@@ -138,7 +138,7 @@ ParsedCookie::ParsedCookie(const std::string& cookie_line)
same_site_index_(0), same_site_index_(0),
priority_index_(0) { priority_index_(0) {
if (cookie_line.size() > kMaxCookieSize) { if (cookie_line.size() > kMaxCookieSize) {
VLOG(1) << "Not parsing cookie, too large: " << cookie_line.size(); DVLOG(1) << "Not parsing cookie, too large: " << cookie_line.size();
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment