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

Unified Diff: net/base/sdch_manager.cc

Issue 100004: Hand craft an A/B test of SDCH compression... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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/sdch_manager.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager.cc
===================================================================
--- net/base/sdch_manager.cc (revision 14822)
+++ net/base/sdch_manager.cc (working copy)
@@ -85,6 +85,7 @@
void SdchManager::BlacklistDomain(const GURL& url) {
if (!global_ )
return;
+ global_->SetAllowLatencyExperiment(url, false);
std::string domain(StringToLowerASCII(url.host()));
int count = global_->blacklisted_domains_[domain];
@@ -104,6 +105,7 @@
void SdchManager::BlacklistDomainForever(const GURL& url) {
if (!global_ )
return;
+ global_->SetAllowLatencyExperiment(url, false);
std::string domain(StringToLowerASCII(url.host()));
global_->exponential_blacklist_count[domain] = INT_MAX;
@@ -331,8 +333,8 @@
UrlSafeBase64Encode(first_48_bits, client_hash);
UrlSafeBase64Encode(second_48_bits, server_hash);
- DCHECK(server_hash->length() == 8);
- DCHECK(client_hash->length() == 8);
+ DCHECK_EQ(server_hash->length(), 8u);
+ DCHECK_EQ(client_hash->length(), 8u);
}
// static
@@ -507,3 +509,23 @@
// TODO(jar): This is not precisely a domain match definition.
return gurl.DomainIs(restriction.data(), restriction.size());
}
+
+//------------------------------------------------------------------------------
+// Methods for supporting latency experiments.
+
+bool SdchManager::AllowLatencyExperiment(const GURL& url) const {
+ return allow_latency_experiment_.end() !=
+ allow_latency_experiment_.find(url.host());
+}
+
+void SdchManager::SetAllowLatencyExperiment(const GURL& url, bool enable) {
+ if (enable) {
+ allow_latency_experiment_.insert(url.host());
+ return;
+ }
+ ExperimentSet::iterator it = allow_latency_experiment_.find(url.host());
+ if (allow_latency_experiment_.end() == it)
+ return; // It was already erased, or never allowed.
+ SdchErrorRecovery(LATENCY_TEST_DISALLOWED);
+ allow_latency_experiment_.erase(it);
+}
« no previous file with comments | « net/base/sdch_manager.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698