summaryrefslogtreecommitdiffstats
path: root/net/socket/socks_client_socket_pool.h
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-12 18:25:21 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-12 18:25:21 +0000
commitdf4b4ef3ac8829b20b07bca9161865ee4ab469eb (patch)
tree68fb5e575e67e8bbaff0d6ff9db4a14f7514c57f /net/socket/socks_client_socket_pool.h
parent9c6527c9d4d289ed4f62194cf116e071b9d49ac9 (diff)
downloadchromium_src-df4b4ef3ac8829b20b07bca9161865ee4ab469eb.zip
chromium_src-df4b4ef3ac8829b20b07bca9161865ee4ab469eb.tar.gz
chromium_src-df4b4ef3ac8829b20b07bca9161865ee4ab469eb.tar.bz2
Make the various SocketParams reference counted.
This is so that the SSLSocketParam can hold one of any of the existing SocketParams. BUG=30357 TEST=existing unit tests Review URL: http://codereview.chromium.org/2848029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52107 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socks_client_socket_pool.h')
-rw-r--r--net/socket/socks_client_socket_pool.h31
1 files changed, 14 insertions, 17 deletions
diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h
index 7da2af54..6a2ed80 100644
--- a/net/socket/socks_client_socket_pool.h
+++ b/net/socket/socks_client_socket_pool.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "net/base/host_port_pair.h"
@@ -24,28 +25,24 @@ namespace net {
class ClientSocketFactory;
class ConnectJobFactory;
-class SOCKSSocketParams {
+class SOCKSSocketParams : public base::RefCounted<SOCKSSocketParams> {
public:
- SOCKSSocketParams(const TCPSocketParams& proxy_server, bool socks_v5,
- const HostPortPair& host_port_pair,
- RequestPriority priority, const GURL& referrer)
- : tcp_params_(proxy_server),
- destination_(host_port_pair.host, host_port_pair.port),
- socks_v5_(socks_v5) {
- // The referrer is used by the DNS prefetch system to correlate resolutions
- // with the page that triggered them. It doesn't impact the actual addresses
- // that we resolve to.
- destination_.set_referrer(referrer);
- destination_.set_priority(priority);
- }
+ SOCKSSocketParams(const scoped_refptr<TCPSocketParams>& proxy_server,
+ bool socks_v5, const HostPortPair& host_port_pair,
+ RequestPriority priority, const GURL& referrer);
- const TCPSocketParams& tcp_params() const { return tcp_params_; }
+ const scoped_refptr<TCPSocketParams>& tcp_params() const {
+ return tcp_params_;
+ }
const HostResolver::RequestInfo& destination() const { return destination_; }
bool is_socks_v5() const { return socks_v5_; }
private:
+ friend class base::RefCounted<SOCKSSocketParams>;
+ ~SOCKSSocketParams();
+
// The tcp connection must point toward the proxy server.
- const TCPSocketParams tcp_params_;
+ const scoped_refptr<TCPSocketParams> tcp_params_;
// This is the HTTP destination.
HostResolver::RequestInfo destination_;
const bool socks_v5_;
@@ -56,7 +53,7 @@ class SOCKSSocketParams {
class SOCKSConnectJob : public ConnectJob {
public:
SOCKSConnectJob(const std::string& group_name,
- const SOCKSSocketParams& params,
+ const scoped_refptr<SOCKSSocketParams>& params,
const base::TimeDelta& timeout_duration,
const scoped_refptr<TCPClientSocketPool>& tcp_pool,
const scoped_refptr<HostResolver> &host_resolver,
@@ -91,7 +88,7 @@ class SOCKSConnectJob : public ConnectJob {
int DoSOCKSConnect();
int DoSOCKSConnectComplete(int result);
- SOCKSSocketParams socks_params_;
+ scoped_refptr<SOCKSSocketParams> socks_params_;
const scoped_refptr<TCPClientSocketPool> tcp_pool_;
const scoped_refptr<HostResolver> resolver_;