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

Unified Diff: net/spdy/spdy_session_pool.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/spdy/spdy_session_pool.cc
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 4747f0595039e57a99203dece4302d321d9d2104..61234467b549a836c8e8a062f4258f0ac7ea0981 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -12,17 +12,16 @@
#include "net/http/http_server_properties.h"
#include "net/spdy/spdy_session.h"
-
namespace net {
namespace {
enum SpdySessionGetTypes {
- CREATED_NEW = 0,
- FOUND_EXISTING = 1,
+ CREATED_NEW = 0,
+ FOUND_EXISTING = 1,
FOUND_EXISTING_FROM_IP_POOL = 2,
- IMPORTED_FROM_SOCKET = 3,
- SPDY_SESSION_GET_MAX = 4
+ IMPORTED_FROM_SOCKET = 3,
+ SPDY_SESSION_GET_MAX = 4
};
} // namespace
@@ -51,15 +50,13 @@ SpdySessionPool::SpdySessionPool(
enable_ping_based_connection_checking),
// TODO(akalin): Force callers to have a valid value of
// |default_protocol_|.
- default_protocol_(
- (default_protocol == kProtoUnknown) ?
- kProtoSPDY3 : default_protocol),
+ default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY3
+ : default_protocol),
stream_initial_recv_window_size_(stream_initial_recv_window_size),
initial_max_concurrent_streams_(initial_max_concurrent_streams),
max_concurrent_streams_limit_(max_concurrent_streams_limit),
time_func_(time_func),
- trusted_spdy_proxy_(
- HostPortPair::FromString(trusted_spdy_proxy)) {
+ trusted_spdy_proxy_(HostPortPair::FromString(trusted_spdy_proxy)) {
DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion &&
default_protocol_ <= kProtoSPDYMaximumVersion);
NetworkChangeNotifier::AddIPAddressObserver(this);
@@ -207,7 +204,8 @@ void SpdySessionPool::MakeSessionUnavailable(
RemoveAliases(available_session->spdy_session_key());
const std::set<SpdySessionKey>& aliases = available_session->pooled_aliases();
for (std::set<SpdySessionKey>::const_iterator it = aliases.begin();
- it != aliases.end(); ++it) {
+ it != aliases.end();
+ ++it) {
UnmapKey(*it);
RemoveAliases(*it);
}
@@ -234,19 +232,19 @@ void SpdySessionPool::RemoveUnavailableSession(
// before closing.
void SpdySessionPool::CloseCurrentSessions(net::Error error) {
- CloseCurrentSessionsHelper(error, "Closing current sessions.",
- false /* idle_only */);
+ CloseCurrentSessionsHelper(
+ error, "Closing current sessions.", false /* idle_only */);
}
void SpdySessionPool::CloseCurrentIdleSessions() {
- CloseCurrentSessionsHelper(ERR_ABORTED, "Closing idle sessions.",
- true /* idle_only */);
+ CloseCurrentSessionsHelper(
+ ERR_ABORTED, "Closing idle sessions.", true /* idle_only */);
}
void SpdySessionPool::CloseAllSessions() {
while (!sessions_.empty()) {
- CloseCurrentSessionsHelper(ERR_ABORTED, "Closing all sessions.",
- false /* idle_only */);
+ CloseCurrentSessionsHelper(
+ ERR_ABORTED, "Closing all sessions.", false /* idle_only */);
}
}
@@ -254,7 +252,8 @@ base::Value* SpdySessionPool::SpdySessionPoolInfoToValue() const {
base::ListValue* list = new base::ListValue();
for (AvailableSessionMap::const_iterator it = available_sessions_.begin();
- it != available_sessions_.end(); ++it) {
+ it != available_sessions_.end();
+ ++it) {
// Only add the session if the key in the map matches the main
// host_port_proxy_pair (not an alias).
const SpdySessionKey& key = it->first;
@@ -268,18 +267,19 @@ base::Value* SpdySessionPool::SpdySessionPoolInfoToValue() const {
void SpdySessionPool::OnIPAddressChanged() {
WeakSessionList current_sessions = GetCurrentSessions();
for (WeakSessionList::const_iterator it = current_sessions.begin();
- it != current_sessions.end(); ++it) {
+ it != current_sessions.end();
+ ++it) {
if (!*it)
continue;
- // For OSs that terminate TCP connections upon relevant network changes
- // there is no need to explicitly close SpdySessions, instead simply mark
- // the sessions as deprecated so they aren't reused.
+// For OSs that terminate TCP connections upon relevant network changes
+// there is no need to explicitly close SpdySessions, instead simply mark
+// the sessions as deprecated so they aren't reused.
#if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
(*it)->MakeUnavailable();
#else
- (*it)->CloseSessionOnError(ERR_NETWORK_CHANGED,
- "Closing current sessions.");
+ (*it)
+ ->CloseSessionOnError(ERR_NETWORK_CHANGED, "Closing current sessions.");
DCHECK(!*it);
#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
DCHECK(!IsSessionAvailable(*it));
@@ -306,7 +306,8 @@ void SpdySessionPool::OnCACertChanged(const X509Certificate* cert) {
bool SpdySessionPool::IsSessionAvailable(
const base::WeakPtr<SpdySession>& session) const {
for (AvailableSessionMap::const_iterator it = available_sessions_.begin();
- it != available_sessions_.end(); ++it) {
+ it != available_sessions_.end();
+ ++it) {
if (it->second.get() == session.get())
return true;
}
@@ -321,9 +322,8 @@ const SpdySessionKey& SpdySessionPool::NormalizeListKey(
static SpdySessionKey* single_domain_key = NULL;
if (!single_domain_key) {
HostPortPair single_domain = HostPortPair("singledomain.com", 80);
- single_domain_key = new SpdySessionKey(single_domain,
- ProxyServer::Direct(),
- PRIVACY_MODE_DISABLED);
+ single_domain_key = new SpdySessionKey(
+ single_domain, ProxyServer::Direct(), PRIVACY_MODE_DISABLED);
}
return *single_domain_key;
}
@@ -339,8 +339,7 @@ void SpdySessionPool::MapKeyToAvailableSession(
}
SpdySessionPool::AvailableSessionMap::iterator
-SpdySessionPool::LookupAvailableSessionByKey(
- const SpdySessionKey& key) {
+SpdySessionPool::LookupAvailableSessionByKey(const SpdySessionKey& key) {
const SpdySessionKey& normalized_key = NormalizeListKey(key);
return available_sessions_.find(normalized_key);
}
@@ -354,7 +353,7 @@ void SpdySessionPool::UnmapKey(const SpdySessionKey& key) {
void SpdySessionPool::RemoveAliases(const SpdySessionKey& key) {
// Walk the aliases map, find references to this pair.
// TODO(mbelshe): Figure out if this is too expensive.
- for (AliasMap::iterator it = aliases_.begin(); it != aliases_.end(); ) {
+ for (AliasMap::iterator it = aliases_.begin(); it != aliases_.end();) {
if (it->second.Equals(key)) {
AliasMap::iterator old_it = it;
++it;
@@ -367,20 +366,20 @@ void SpdySessionPool::RemoveAliases(const SpdySessionKey& key) {
SpdySessionPool::WeakSessionList SpdySessionPool::GetCurrentSessions() const {
WeakSessionList current_sessions;
- for (SessionSet::const_iterator it = sessions_.begin();
- it != sessions_.end(); ++it) {
+ for (SessionSet::const_iterator it = sessions_.begin(); it != sessions_.end();
+ ++it) {
current_sessions.push_back((*it)->GetWeakPtr());
}
return current_sessions;
}
-void SpdySessionPool::CloseCurrentSessionsHelper(
- Error error,
- const std::string& description,
- bool idle_only) {
+void SpdySessionPool::CloseCurrentSessionsHelper(Error error,
+ const std::string& description,
+ bool idle_only) {
WeakSessionList current_sessions = GetCurrentSessions();
for (WeakSessionList::const_iterator it = current_sessions.begin();
- it != current_sessions.end(); ++it) {
+ it != current_sessions.end();
+ ++it) {
if (!*it)
continue;

Powered by Google App Engine
This is Rietveld 408576698