| Index: net/base/sdch_manager.cc
|
| diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
|
| index 9e8fd98097865dc8ea08fcf99c69ad6975ec18b6..268f42524f2768039eaa148048d4009435e87099 100644
|
| --- a/net/base/sdch_manager.cc
|
| +++ b/net/base/sdch_manager.cc
|
| @@ -117,8 +117,8 @@ bool SdchManager::Dictionary::CanSet(const std::string& domain,
|
| return false; // Domain is required.
|
| }
|
| if (registry_controlled_domains::GetDomainAndRegistry(
|
| - domain,
|
| - registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES).empty()) {
|
| + domain, registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)
|
| + .empty()) {
|
| SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN);
|
| return false; // domain was a TLD.
|
| }
|
| @@ -133,15 +133,14 @@ bool SdchManager::Dictionary::CanSet(const std::string& domain,
|
| if (referrer_url_host.size() == postfix_domain_index + domain.size()) {
|
| // It is a postfix... so check to see if there's a dot in the prefix.
|
| size_t end_of_host_index = referrer_url_host.find_first_of('.');
|
| - if (referrer_url_host.npos != end_of_host_index &&
|
| + if (referrer_url_host.npos != end_of_host_index &&
|
| end_of_host_index < postfix_domain_index) {
|
| SdchErrorRecovery(DICTIONARY_REFERER_URL_HAS_DOT_IN_PREFIX);
|
| return false;
|
| }
|
| }
|
|
|
| - if (!ports.empty()
|
| - && 0 == ports.count(dictionary_url.EffectiveIntPort())) {
|
| + if (!ports.empty() && 0 == ports.count(dictionary_url.EffectiveIntPort())) {
|
| SdchErrorRecovery(DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL);
|
| return false;
|
| }
|
| @@ -166,8 +165,7 @@ bool SdchManager::Dictionary::CanUse(const GURL& referring_url) {
|
| SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_DOMAIN);
|
| return false;
|
| }
|
| - if (!ports_.empty()
|
| - && 0 == ports_.count(referring_url.EffectiveIntPort())) {
|
| + if (!ports_.empty() && 0 == ports_.count(referring_url.EffectiveIntPort())) {
|
| SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_PORT_LIST);
|
| return false;
|
| }
|
| @@ -240,7 +238,7 @@ SdchManager::~SdchManager() {
|
| // static
|
| void SdchManager::Shutdown() {
|
| EnableSdchSupport(false);
|
| - if (!global_ )
|
| + if (!global_)
|
| return;
|
| global_->set_sdch_fetcher(NULL);
|
| }
|
| @@ -272,7 +270,7 @@ void SdchManager::EnableSecureSchemeSupport(bool enabled) {
|
|
|
| // static
|
| void SdchManager::BlacklistDomain(const GURL& url) {
|
| - if (!global_ )
|
| + if (!global_)
|
| return;
|
| global_->SetAllowLatencyExperiment(url, false);
|
|
|
| @@ -292,7 +290,7 @@ void SdchManager::BlacklistDomain(const GURL& url) {
|
|
|
| // static
|
| void SdchManager::BlacklistDomainForever(const GURL& url) {
|
| - if (!global_ )
|
| + if (!global_)
|
| return;
|
| global_->SetAllowLatencyExperiment(url, false);
|
|
|
| @@ -330,7 +328,7 @@ int SdchManager::BlacklistDomainExponential(const std::string& domain) {
|
|
|
| bool SdchManager::IsInSupportedDomain(const GURL& url) {
|
| DCHECK(CalledOnValidThread());
|
| - if (!g_sdch_enabled_ )
|
| + if (!g_sdch_enabled_)
|
| return false;
|
|
|
| if (blacklisted_domains_.empty())
|
| @@ -394,7 +392,7 @@ bool SdchManager::CanFetchDictionary(const GURL& referring_url,
|
| }
|
|
|
| bool SdchManager::AddSdchDictionary(const std::string& dictionary_text,
|
| - const GURL& dictionary_url) {
|
| + const GURL& dictionary_url) {
|
| DCHECK(CalledOnValidThread());
|
| std::string client_hash;
|
| std::string server_hash;
|
| @@ -433,8 +431,8 @@ bool SdchManager::AddSdchDictionary(const std::string& dictionary_text,
|
| if (colon_index > line_end)
|
| break;
|
|
|
| - size_t value_start = dictionary_text.find_first_not_of(" \t",
|
| - colon_index + 1);
|
| + size_t value_start =
|
| + dictionary_text.find_first_not_of(" \t", colon_index + 1);
|
| if (std::string::npos != value_start) {
|
| if (value_start >= line_end)
|
| break;
|
| @@ -484,16 +482,22 @@ bool SdchManager::AddSdchDictionary(const std::string& dictionary_text,
|
| UMA_HISTOGRAM_COUNTS("Sdch3.Dictionary size loaded", dictionary_text.size());
|
| DVLOG(1) << "Loaded dictionary with client hash " << client_hash
|
| << " and server hash " << server_hash;
|
| - Dictionary* dictionary =
|
| - new Dictionary(dictionary_text, header_end + 2, client_hash,
|
| - dictionary_url, domain, path, expiration, ports);
|
| + Dictionary* dictionary = new Dictionary(dictionary_text,
|
| + header_end + 2,
|
| + client_hash,
|
| + dictionary_url,
|
| + domain,
|
| + path,
|
| + expiration,
|
| + ports);
|
| dictionary->AddRef();
|
| dictionaries_[server_hash] = dictionary;
|
| return true;
|
| }
|
|
|
| void SdchManager::GetVcdiffDictionary(const std::string& server_hash,
|
| - const GURL& referring_url, Dictionary** dictionary) {
|
| + const GURL& referring_url,
|
| + Dictionary** dictionary) {
|
| DCHECK(CalledOnValidThread());
|
| *dictionary = NULL;
|
| DictionaryMap::iterator it = dictionaries_.find(server_hash);
|
| @@ -514,7 +518,8 @@ void SdchManager::GetAvailDictionaryList(const GURL& target_url,
|
| DCHECK(CalledOnValidThread());
|
| int count = 0;
|
| for (DictionaryMap::iterator it = dictionaries_.begin();
|
| - it != dictionaries_.end(); ++it) {
|
| + it != dictionaries_.end();
|
| + ++it) {
|
| if (!it->second->CanAdvertise(target_url))
|
| continue;
|
| ++count;
|
| @@ -529,7 +534,8 @@ void SdchManager::GetAvailDictionaryList(const GURL& target_url,
|
|
|
| // static
|
| void SdchManager::GenerateHash(const std::string& dictionary_text,
|
| - std::string* client_hash, std::string* server_hash) {
|
| + std::string* client_hash,
|
| + std::string* server_hash) {
|
| char binary_hash[32];
|
| crypto::SHA256HashString(dictionary_text, binary_hash, sizeof(binary_hash));
|
|
|
| @@ -548,7 +554,7 @@ void SdchManager::GenerateHash(const std::string& dictionary_text,
|
| bool SdchManager::AllowLatencyExperiment(const GURL& url) const {
|
| DCHECK(CalledOnValidThread());
|
| return allow_latency_experiment_.end() !=
|
| - allow_latency_experiment_.find(url.host());
|
| + allow_latency_experiment_.find(url.host());
|
| }
|
|
|
| void SdchManager::SetAllowLatencyExperiment(const GURL& url, bool enable) {
|
|
|