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

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

Issue 2363003: Rework the logging for sockets/connectjobs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | net/socket/socks_client_socket_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 23 matching lines...) Expand all
34 socks_v5_(socks_v5) { 34 socks_v5_(socks_v5) {
35 // The referrer is used by the DNS prefetch system to correlate resolutions 35 // The referrer is used by the DNS prefetch system to correlate resolutions
36 // with the page that triggered them. It doesn't impact the actual addresses 36 // with the page that triggered them. It doesn't impact the actual addresses
37 // that we resolve to. 37 // that we resolve to.
38 destination_.set_referrer(referrer); 38 destination_.set_referrer(referrer);
39 destination_.set_priority(priority); 39 destination_.set_priority(priority);
40 } 40 }
41 41
42 const TCPSocketParams& tcp_params() const { return tcp_params_; } 42 const TCPSocketParams& tcp_params() const { return tcp_params_; }
43 const HostResolver::RequestInfo& destination() const { return destination_; } 43 const HostResolver::RequestInfo& destination() const { return destination_; }
44 bool is_socks_v5() const { return socks_v5_; }; 44 bool is_socks_v5() const { return socks_v5_; }
45 45
46 private: 46 private:
47 // The tcp connection must point toward the proxy server. 47 // The tcp connection must point toward the proxy server.
48 const TCPSocketParams tcp_params_; 48 const TCPSocketParams tcp_params_;
49 // This is the HTTP destination. 49 // This is the HTTP destination.
50 HostResolver::RequestInfo destination_; 50 HostResolver::RequestInfo destination_;
51 const bool socks_v5_; 51 const bool socks_v5_;
52 }; 52 };
53 53
54 // SOCKSConnectJob handles the handshake to a socks server after setting up 54 // SOCKSConnectJob handles the handshake to a socks server after setting up
55 // an underlying transport socket. 55 // an underlying transport socket.
56 class SOCKSConnectJob : public ConnectJob { 56 class SOCKSConnectJob : public ConnectJob {
57 public: 57 public:
58 SOCKSConnectJob(const std::string& group_name, 58 SOCKSConnectJob(const std::string& group_name,
59 const SOCKSSocketParams& params, 59 const SOCKSSocketParams& params,
60 const base::TimeDelta& timeout_duration, 60 const base::TimeDelta& timeout_duration,
61 const scoped_refptr<TCPClientSocketPool>& tcp_pool, 61 const scoped_refptr<TCPClientSocketPool>& tcp_pool,
62 const scoped_refptr<HostResolver> &host_resolver, 62 const scoped_refptr<HostResolver> &host_resolver,
63 Delegate* delegate, 63 Delegate* delegate,
64 const BoundNetLog& net_log); 64 NetLog* net_log);
65 virtual ~SOCKSConnectJob(); 65 virtual ~SOCKSConnectJob();
66 66
67 // ConnectJob methods. 67 // ConnectJob methods.
68 virtual LoadState GetLoadState() const; 68 virtual LoadState GetLoadState() const;
69 69
70 private: 70 private:
71 enum State { 71 enum State {
72 kStateTCPConnect, 72 kStateTCPConnect,
73 kStateTCPConnectComplete, 73 kStateTCPConnectComplete,
74 kStateSOCKSConnect, 74 kStateSOCKSConnect,
(...skipping 29 matching lines...) Expand all
104 }; 104 };
105 105
106 class SOCKSClientSocketPool : public ClientSocketPool { 106 class SOCKSClientSocketPool : public ClientSocketPool {
107 public: 107 public:
108 SOCKSClientSocketPool( 108 SOCKSClientSocketPool(
109 int max_sockets, 109 int max_sockets,
110 int max_sockets_per_group, 110 int max_sockets_per_group,
111 const scoped_refptr<ClientSocketPoolHistograms>& histograms, 111 const scoped_refptr<ClientSocketPoolHistograms>& histograms,
112 const scoped_refptr<HostResolver>& host_resolver, 112 const scoped_refptr<HostResolver>& host_resolver,
113 const scoped_refptr<TCPClientSocketPool>& tcp_pool, 113 const scoped_refptr<TCPClientSocketPool>& tcp_pool,
114 NetworkChangeNotifier* network_change_notifier); 114 NetworkChangeNotifier* network_change_notifier,
115 NetLog* net_log);
115 116
116 // ClientSocketPool methods: 117 // ClientSocketPool methods:
117 virtual int RequestSocket(const std::string& group_name, 118 virtual int RequestSocket(const std::string& group_name,
118 const void* connect_params, 119 const void* connect_params,
119 RequestPriority priority, 120 RequestPriority priority,
120 ClientSocketHandle* handle, 121 ClientSocketHandle* handle,
121 CompletionCallback* callback, 122 CompletionCallback* callback,
122 const BoundNetLog& net_log); 123 const BoundNetLog& net_log);
123 124
124 virtual void CancelRequest(const std::string& group_name, 125 virtual void CancelRequest(const std::string& group_name,
(...skipping 23 matching lines...) Expand all
148 149
149 protected: 150 protected:
150 virtual ~SOCKSClientSocketPool(); 151 virtual ~SOCKSClientSocketPool();
151 152
152 private: 153 private:
153 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase; 154 typedef ClientSocketPoolBase<SOCKSSocketParams> PoolBase;
154 155
155 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory { 156 class SOCKSConnectJobFactory : public PoolBase::ConnectJobFactory {
156 public: 157 public:
157 SOCKSConnectJobFactory(const scoped_refptr<TCPClientSocketPool>& tcp_pool, 158 SOCKSConnectJobFactory(const scoped_refptr<TCPClientSocketPool>& tcp_pool,
158 HostResolver* host_resolver) 159 HostResolver* host_resolver,
160 NetLog* net_log)
159 : tcp_pool_(tcp_pool), 161 : tcp_pool_(tcp_pool),
160 host_resolver_(host_resolver) {} 162 host_resolver_(host_resolver),
163 net_log_(net_log) {}
161 164
162 virtual ~SOCKSConnectJobFactory() {} 165 virtual ~SOCKSConnectJobFactory() {}
163 166
164 // ClientSocketPoolBase::ConnectJobFactory methods. 167 // ClientSocketPoolBase::ConnectJobFactory methods.
165 virtual ConnectJob* NewConnectJob( 168 virtual ConnectJob* NewConnectJob(
166 const std::string& group_name, 169 const std::string& group_name,
167 const PoolBase::Request& request, 170 const PoolBase::Request& request,
168 ConnectJob::Delegate* delegate, 171 ConnectJob::Delegate* delegate) const;
169 const BoundNetLog& net_log) const;
170 172
171 virtual base::TimeDelta ConnectionTimeout() const; 173 virtual base::TimeDelta ConnectionTimeout() const;
172 174
173 private: 175 private:
174 const scoped_refptr<TCPClientSocketPool> tcp_pool_; 176 const scoped_refptr<TCPClientSocketPool> tcp_pool_;
175 const scoped_refptr<HostResolver> host_resolver_; 177 const scoped_refptr<HostResolver> host_resolver_;
178 NetLog* net_log_;
176 179
177 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJobFactory); 180 DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJobFactory);
178 }; 181 };
179 182
180 PoolBase base_; 183 PoolBase base_;
181 184
182 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool); 185 DISALLOW_COPY_AND_ASSIGN(SOCKSClientSocketPool);
183 }; 186 };
184 187
185 REGISTER_SOCKET_PARAMS_FOR_POOL(SOCKSClientSocketPool, SOCKSSocketParams) 188 REGISTER_SOCKET_PARAMS_FOR_POOL(SOCKSClientSocketPool, SOCKSSocketParams)
186 189
187 } // namespace net 190 } // namespace net
188 191
189 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_ 192 #endif // NET_SOCKET_SOCKS_CLIENT_SOCKET_POOL_H_
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | net/socket/socks_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698