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

Unified Diff: net/base/sdch_manager.cc

Issue 321283002: Clear SDCH information on "Clear browsing data" path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: net/base/sdch_manager.cc
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 3b2082d14c0b75e41b2f722f2b2a4269776d5421..a8d950037afec8e8ae3e1dcf8cabe5aef2fd1b8e 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -224,6 +224,20 @@ SdchManager::~SdchManager() {
}
}
+void SdchManager::ClearData() {
+ blacklisted_domains_.clear();
+ exponential_blacklist_count_.clear();
+ allow_latency_experiment_.clear();
+ if (fetcher_.get())
+ fetcher_->Cancel();
+
+ // Note that this may result in not having dictionaries we've advertised
+ // for incoming responses. The window is relatively small (as ClearData()
+ // is not expected to be called frequently), so we rely on meta-refresh
+ // to handle this case.
+ dictionaries_.clear();
+}
+
// static
void SdchManager::SdchErrorRecovery(ProblemCodes problem) {
UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE);
@@ -252,9 +266,9 @@ void SdchManager::BlacklistDomain(const GURL& url) {
if (count > 0)
return; // Domain is already blacklisted.
- count = 1 + 2 * exponential_blacklist_count[domain];
+ count = 1 + 2 * exponential_blacklist_count_[domain];
if (count > 0)
- exponential_blacklist_count[domain] = count;
+ exponential_blacklist_count_[domain] = count;
else
count = INT_MAX;
@@ -265,13 +279,13 @@ void SdchManager::BlacklistDomainForever(const GURL& url) {
SetAllowLatencyExperiment(url, false);
std::string domain(StringToLowerASCII(url.host()));
- exponential_blacklist_count[domain] = INT_MAX;
+ exponential_blacklist_count_[domain] = INT_MAX;
blacklisted_domains_[domain] = INT_MAX;
}
void SdchManager::ClearBlacklistings() {
blacklisted_domains_.clear();
- exponential_blacklist_count.clear();
+ exponential_blacklist_count_.clear();
}
void SdchManager::ClearDomainBlacklisting(const std::string& domain) {
@@ -285,10 +299,10 @@ int SdchManager::BlackListDomainCount(const std::string& domain) {
}
int SdchManager::BlacklistDomainExponential(const std::string& domain) {
- if (exponential_blacklist_count.end() ==
- exponential_blacklist_count.find(domain))
+ if (exponential_blacklist_count_.end() ==
+ exponential_blacklist_count_.find(domain))
return 0;
- return exponential_blacklist_count[StringToLowerASCII(domain)];
+ return exponential_blacklist_count_[StringToLowerASCII(domain)];
}
bool SdchManager::IsInSupportedDomain(const GURL& url) {

Powered by Google App Engine
This is Rietveld 408576698