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

Unified Diff: net/base/sdch_manager.cc

Issue 642403002: git cl format the first third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 6 years, 1 month 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 1285ad9383aa1784d92ebd3481c910f69454b091..df8dc649c5ebe328d25466cb4ac85f2d824a5b08 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -140,8 +140,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.
}
@@ -156,15 +156,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;
}
@@ -188,8 +187,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;
}
@@ -319,8 +317,8 @@ void SdchManager::ClearBlacklistings() {
}
void SdchManager::ClearDomainBlacklisting(const std::string& domain) {
- BlacklistInfo* blacklist_info = &blacklisted_domains_[
- base::StringToLowerASCII(domain)];
+ BlacklistInfo* blacklist_info =
+ &blacklisted_domains_[base::StringToLowerASCII(domain)];
blacklist_info->count = 0;
blacklist_info->reason = MIN_PROBLEM_CODE;
}
@@ -343,7 +341,7 @@ int SdchManager::BlacklistDomainExponential(const std::string& domain) {
bool SdchManager::IsInSupportedDomain(const GURL& url) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (!g_sdch_enabled_ )
+ if (!g_sdch_enabled_)
return false;
if (!secure_scheme_supported() && url.SchemeIsSecure())
@@ -377,8 +375,7 @@ void SdchManager::OnGetDictionary(const GURL& request_url,
if (!CanFetchDictionary(request_url, dictionary_url))
return;
- FOR_EACH_OBSERVER(SdchObserver,
- observers_,
+ FOR_EACH_OBSERVER(SdchObserver, observers_,
OnGetDictionary(this, request_url, dictionary_url));
}
@@ -416,10 +413,9 @@ bool SdchManager::CanFetchDictionary(const GURL& referring_url,
return true;
}
-void SdchManager::GetVcdiffDictionary(
- const std::string& server_hash,
- const GURL& referring_url,
- scoped_refptr<Dictionary>* dictionary) {
+void SdchManager::GetVcdiffDictionary(const std::string& server_hash,
+ const GURL& referring_url,
+ scoped_refptr<Dictionary>* dictionary) {
DCHECK(thread_checker_.CalledOnValidThread());
*dictionary = NULL;
DictionaryMap::iterator it = dictionaries_.find(server_hash);
@@ -459,7 +455,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));
@@ -478,7 +475,7 @@ void SdchManager::GenerateHash(const std::string& dictionary_text,
bool SdchManager::AllowLatencyExperiment(const GURL& url) const {
DCHECK(thread_checker_.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) {
@@ -503,14 +500,14 @@ void SdchManager::RemoveObserver(SdchObserver* observer) {
}
void SdchManager::AddSdchDictionary(const std::string& dictionary_text,
- const GURL& dictionary_url) {
+ const GURL& dictionary_url) {
DCHECK(thread_checker_.CalledOnValidThread());
std::string client_hash;
std::string server_hash;
GenerateHash(dictionary_text, &client_hash, &server_hash);
if (dictionaries_.find(server_hash) != dictionaries_.end()) {
SdchErrorRecovery(DICTIONARY_ALREADY_LOADED);
- return; // Already loaded.
+ return; // Already loaded.
}
std::string domain, path;
@@ -519,13 +516,13 @@ void SdchManager::AddSdchDictionary(const std::string& dictionary_text,
if (dictionary_text.empty()) {
SdchErrorRecovery(DICTIONARY_HAS_NO_TEXT);
- return; // Missing header.
+ return; // Missing header.
}
size_t header_end = dictionary_text.find("\n\n");
if (std::string::npos == header_end) {
SdchErrorRecovery(DICTIONARY_HAS_NO_HEADER);
- return; // Missing header.
+ return; // Missing header.
}
size_t line_start = 0; // Start of line being parsed.
while (1) {
@@ -536,14 +533,14 @@ void SdchManager::AddSdchDictionary(const std::string& dictionary_text,
size_t colon_index = dictionary_text.find(':', line_start);
if (std::string::npos == colon_index) {
SdchErrorRecovery(DICTIONARY_HEADER_LINE_MISSING_COLON);
- return; // Illegal line missing a colon.
+ return; // Illegal line missing a colon.
}
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;
@@ -600,10 +597,9 @@ void 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_normalized, domain,
- path, expiration, ports);
+ Dictionary* dictionary = new Dictionary(
+ dictionary_text, header_end + 2, client_hash, dictionary_url_normalized,
+ domain, path, expiration, ports);
dictionaries_[server_hash] = dictionary;
return;
}

Powered by Google App Engine
This is Rietveld 408576698