Index: net/socket/client_socket_pool_base.h |
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h |
index 8079cd4e5c74a80b5f7c1e802c7c009a4557829d..eb56108092d52c010f66c369fe113f9439c9ceb3 100644 |
--- a/net/socket/client_socket_pool_base.h |
+++ b/net/socket/client_socket_pool_base.h |
@@ -67,8 +67,7 @@ class NET_EXPORT_PRIVATE ConnectJob { |
// Alerts the delegate that the connection completed. |job| must |
// be destroyed by the delegate. A scoped_ptr<> isn't used because |
// the caller of this function doesn't own |job|. |
- virtual void OnConnectJobComplete(int result, |
- ConnectJob* job) = 0; |
+ virtual void OnConnectJobComplete(int result, ConnectJob* job) = 0; |
private: |
DISALLOW_COPY_AND_ASSIGN(Delegate); |
@@ -161,7 +160,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
// Used to specify specific behavior for the ClientSocketPool. |
enum Flag { |
- NORMAL = 0, // Normal behavior. |
+ NORMAL = 0, // Normal behavior. |
NO_IDLE_SOCKETS = 0x1, // Do not return an idle socket. Create a new one. |
}; |
@@ -211,13 +210,12 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); |
}; |
- ClientSocketPoolBaseHelper( |
- HigherLayeredPool* pool, |
- int max_sockets, |
- int max_sockets_per_group, |
- base::TimeDelta unused_idle_socket_timeout, |
- base::TimeDelta used_idle_socket_timeout, |
- ConnectJobFactory* connect_job_factory); |
+ ClientSocketPoolBaseHelper(HigherLayeredPool* pool, |
+ int max_sockets, |
+ int max_sockets_per_group, |
+ base::TimeDelta unused_idle_socket_timeout, |
+ base::TimeDelta used_idle_socket_timeout, |
+ ConnectJobFactory* connect_job_factory); |
virtual ~ClientSocketPoolBaseHelper(); |
@@ -243,8 +241,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
int num_sockets); |
// See ClientSocketPool::CancelRequest for documentation on this function. |
- void CancelRequest(const std::string& group_name, |
- ClientSocketHandle* handle); |
+ void CancelRequest(const std::string& group_name, ClientSocketHandle* handle); |
// See ClientSocketPool::ReleaseSocket for documentation on this function. |
void ReleaseSocket(const std::string& group_name, |
@@ -258,9 +255,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
void CloseIdleSockets(); |
// See ClientSocketPool::IdleSocketCount() for documentation on this function. |
- int idle_socket_count() const { |
- return idle_socket_count_; |
- } |
+ int idle_socket_count() const { return idle_socket_count_; } |
// See ClientSocketPool::IdleSocketCountInGroup() for documentation on this |
// function. |
@@ -371,7 +366,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
bool IsEmpty() const { |
return active_socket_count_ == 0 && idle_sockets_.empty() && |
- jobs_.empty() && pending_requests_.empty(); |
+ jobs_.empty() && pending_requests_.empty(); |
} |
bool HasAvailableSocketSlot(int max_sockets_per_group) const { |
@@ -380,12 +375,12 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
int NumActiveSocketSlots() const { |
return active_socket_count_ + static_cast<int>(jobs_.size()) + |
- static_cast<int>(idle_sockets_.size()); |
+ static_cast<int>(idle_sockets_.size()); |
} |
bool IsStalledOnPoolMaxSockets(int max_sockets_per_group) const { |
return HasAvailableSocketSlot(max_sockets_per_group) && |
- pending_requests_.size() > jobs_.size(); |
+ pending_requests_.size() > jobs_.size(); |
} |
// Returns the priority of the top of the pending request queue |
@@ -415,13 +410,9 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
void RemoveJob(ConnectJob* job); |
void RemoveAllJobs(); |
- bool has_pending_requests() const { |
- return !pending_requests_.empty(); |
- } |
+ bool has_pending_requests() const { return !pending_requests_.empty(); } |
- size_t pending_request_count() const { |
- return pending_requests_.size(); |
- } |
+ size_t pending_request_count() const { return pending_requests_.size(); } |
// Gets (but does not remove) the next pending request. Returns |
// NULL if there are no pending requests. |
@@ -460,9 +451,8 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
const RequestQueue::Pointer& pointer); |
// Called when the backup socket timer fires. |
- void OnBackupJobTimerFired( |
- std::string group_name, |
- ClientSocketPoolBaseHelper* pool); |
+ void OnBackupJobTimerFired(std::string group_name, |
+ ClientSocketPoolBaseHelper* pool); |
// Checks that |unassigned_job_count_| does not execeed the number of |
// ConnectJobs. |
@@ -519,9 +509,7 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
// Called when timer_ fires. This method scans the idle sockets removing |
// sockets that timed out or can't be reused. |
- void OnCleanupTimerFired() { |
- CleanupIdleSockets(false); |
- } |
+ void OnCleanupTimerFired() { CleanupIdleSockets(false); } |
// Removes |job| from |group|, which must already own |job|. |
void RemoveConnectJob(ConnectJob* job, Group* group); |
@@ -566,7 +554,8 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
bool AssignIdleSocketToRequest(const Request& request, Group* group); |
static void LogBoundConnectJobToRequest( |
- const NetLog::Source& connect_job_source, const Request& request); |
+ const NetLog::Source& connect_job_source, |
+ const Request& request); |
// Same as CloseOneIdleSocket() except it won't close an idle socket in |
// |group|. If |group| is NULL, it is ignored. Returns true if it closed a |
@@ -580,8 +569,9 @@ class NET_EXPORT_PRIVATE ClientSocketPoolBaseHelper |
// Posts a task to call InvokeUserCallback() on the next iteration through the |
// current message loop. Inserts |callback| into |pending_callback_map_|, |
// keyed by |handle|. |
- void InvokeUserCallbackLater( |
- ClientSocketHandle* handle, const CompletionCallback& callback, int rv); |
+ void InvokeUserCallbackLater(ClientSocketHandle* handle, |
+ const CompletionCallback& callback, |
+ int rv); |
// Invokes the user callback for |handle|. By the time this task has run, |
// it's possible that the request has been cancelled, so |handle| may not |
@@ -668,8 +658,12 @@ class ClientSocketPoolBase { |
bool ignore_limits, |
const scoped_refptr<SocketParams>& params, |
const BoundNetLog& net_log) |
- : internal::ClientSocketPoolBaseHelper::Request( |
- handle, callback, priority, ignore_limits, flags, net_log), |
+ : internal::ClientSocketPoolBaseHelper::Request(handle, |
+ callback, |
+ priority, |
+ ignore_limits, |
+ flags, |
+ net_log), |
params_(params) {} |
const scoped_refptr<SocketParams>& params() const { return params_; } |
@@ -700,17 +694,19 @@ class ClientSocketPoolBase { |
// long to leave an unused idle socket open before closing it. |
// |used_idle_socket_timeout| specifies how long to leave a previously used |
// idle socket open before closing it. |
- ClientSocketPoolBase( |
- HigherLayeredPool* self, |
- int max_sockets, |
- int max_sockets_per_group, |
- ClientSocketPoolHistograms* histograms, |
- base::TimeDelta unused_idle_socket_timeout, |
- base::TimeDelta used_idle_socket_timeout, |
- ConnectJobFactory* connect_job_factory) |
+ ClientSocketPoolBase(HigherLayeredPool* self, |
+ int max_sockets, |
+ int max_sockets_per_group, |
+ ClientSocketPoolHistograms* histograms, |
+ base::TimeDelta unused_idle_socket_timeout, |
+ base::TimeDelta used_idle_socket_timeout, |
+ ConnectJobFactory* connect_job_factory) |
: histograms_(histograms), |
- helper_(self, max_sockets, max_sockets_per_group, |
- unused_idle_socket_timeout, used_idle_socket_timeout, |
+ helper_(self, |
+ max_sockets, |
+ max_sockets_per_group, |
+ unused_idle_socket_timeout, |
+ used_idle_socket_timeout, |
new ConnectJobFactoryAdaptor(connect_job_factory)) {} |
virtual ~ClientSocketPoolBase() {} |
@@ -737,10 +733,13 @@ class ClientSocketPoolBase { |
const CompletionCallback& callback, |
const BoundNetLog& net_log) { |
scoped_ptr<const Request> request( |
- new Request(handle, callback, priority, |
+ new Request(handle, |
+ callback, |
+ priority, |
internal::ClientSocketPoolBaseHelper::NORMAL, |
params->ignore_limits(), |
- params, net_log)); |
+ params, |
+ net_log)); |
return helper_.RequestSocket( |
group_name, |
request.template PassAs< |
@@ -825,9 +824,7 @@ class ClientSocketPoolBase { |
return helper_.ConnectionTimeout(); |
} |
- ClientSocketPoolHistograms* histograms() const { |
- return histograms_; |
- } |
+ ClientSocketPoolHistograms* histograms() const { return histograms_; } |
void EnableConnectBackupJobs() { helper_.EnableConnectBackupJobs(); } |