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

Side by Side Diff: net/socket/socks_client_socket_pool.h

Issue 18796003: When an idle socket is added back to a socket pool, check for stalled jobs in lower pools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ 5 #ifndef NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_
6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ 6 #define NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 State next_state_; 99 State next_state_;
100 CompletionCallback callback_; 100 CompletionCallback callback_;
101 scoped_ptr<ClientSocketHandle> transport_socket_handle_; 101 scoped_ptr<ClientSocketHandle> transport_socket_handle_;
102 scoped_ptr<StreamSocket> socket_; 102 scoped_ptr<StreamSocket> socket_;
103 103
104 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob); 104 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob);
105 }; 105 };
106 106
107 class NET_EXPORT_PRIVATE SOCKSClientSocketPool 107 class NET_EXPORT_PRIVATE SOCKSClientSocketPool
108 : public ClientSocketPool, public LayeredPool { 108 : public ClientSocketPool, public HigherLayeredPool {
109 public: 109 public:
110 typedef SOCKSSocketParams SocketParams; 110 typedef SOCKSSocketParams SocketParams;
111 111
112 SOCKSClientSocketPool( 112 SOCKSClientSocketPool(
113 int max_sockets, 113 int max_sockets,
114 int max_sockets_per_group, 114 int max_sockets_per_group,
115 ClientSocketPoolHistograms* histograms, 115 ClientSocketPoolHistograms* histograms,
116 HostResolver* host_resolver, 116 HostResolver* host_resolver,
117 TransportClientSocketPool* transport_pool, 117 TransportClientSocketPool* transport_pool,
118 NetLog* net_log); 118 NetLog* net_log);
(...skipping 15 matching lines...) Expand all
134 134
135 virtual void CancelRequest(const std::string& group_name, 135 virtual void CancelRequest(const std::string& group_name,
136 ClientSocketHandle* handle) OVERRIDE; 136 ClientSocketHandle* handle) OVERRIDE;
137 137
138 virtual void ReleaseSocket(const std::string& group_name, 138 virtual void ReleaseSocket(const std::string& group_name,
139 scoped_ptr<StreamSocket> socket, 139 scoped_ptr<StreamSocket> socket,
140 int id) OVERRIDE; 140 int id) OVERRIDE;
141 141
142 virtual void FlushWithError(int error) OVERRIDE; 142 virtual void FlushWithError(int error) OVERRIDE;
143 143
144 virtual bool IsStalled() const OVERRIDE;
145
146 virtual void CloseIdleSockets() OVERRIDE; 144 virtual void CloseIdleSockets() OVERRIDE;
147 145
148 virtual int IdleSocketCount() const OVERRIDE; 146 virtual int IdleSocketCount() const OVERRIDE;
149 147
150 virtual int IdleSocketCountInGroup( 148 virtual int IdleSocketCountInGroup(
151 const std::string& group_name) const OVERRIDE; 149 const std::string& group_name) const OVERRIDE;
152 150
153 virtual LoadState GetLoadState( 151 virtual LoadState GetLoadState(
154 const std::string& group_name, 152 const std::string& group_name,
155 const ClientSocketHandle* handle) const OVERRIDE; 153 const ClientSocketHandle* handle) const OVERRIDE;
156 154
157 virtual void AddLayeredPool(LayeredPool* layered_pool) OVERRIDE;
158
159 virtual void RemoveLayeredPool(LayeredPool* layered_pool) OVERRIDE;
160
161 virtual base::DictionaryValue* GetInfoAsValue( 155 virtual base::DictionaryValue* GetInfoAsValue(
162 const std::string& name, 156 const std::string& name,
163 const std::string& type, 157 const std::string& type,
164 bool include_nested_pools) const OVERRIDE; 158 bool include_nested_pools) const OVERRIDE;
165 159
166 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; 160 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE;
167 161
168 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; 162 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE;
169 163
170 // LayeredPool implementation. 164 // LowerLayeredPool implementation.
165 virtual bool IsStalled() const OVERRIDE;
166
167 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE;
168
169 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE;
170
171 // HigherLayeredPool implementation.
171 virtual bool CloseOneIdleConnection() OVERRIDE; 172 virtual bool CloseOneIdleConnection() OVERRIDE;
172 173
173 private: 174 private:
174 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase; 175 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase;
175 176
176 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory { 177 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory {
177 public: 178 public:
178 SOCKSConnectJobFactory(TransportClientSocketPool* transport_pool, 179 SOCKSConnectJobFactory(TransportClientSocketPool* transport_pool,
179 HostResolver* host_resolver, 180 HostResolver* host_resolver,
180 NetLog* net_log) 181 NetLog* net_log)
(...skipping 21 matching lines...) Expand all
202 203
203 TransportClientSocketPool* const transport_pool_; 204 TransportClientSocketPool* const transport_pool_;
204 PoolBase base_; 205 PoolBase base_;
205 206
206 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); 207 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool);
207 }; 208 };
208 209
209 } // namespace net 210 } // namespace net
210 211
211 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ 212 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698