summaryrefslogtreecommitdiffstats
path: root/net/socket_stream
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 23:57:54 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 23:57:54 +0000
commit73c4532bd7f5b84bc822a4acca5c5b8affef4129 (patch)
treedc2a525aab1bda568b52ea78e72c8be79b9165dc /net/socket_stream
parent3209e71131849f3e0d513cd3fd8dca881f05d531 (diff)
downloadchromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.zip
chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.tar.gz
chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.tar.bz2
Stop refcounting HostResolver.
BUG=46049 TEST=none Review URL: http://codereview.chromium.org/3601002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream')
-rw-r--r--net/socket_stream/socket_stream.cc6
-rw-r--r--net/socket_stream/socket_stream.h2
-rw-r--r--net/socket_stream/socket_stream_unittest.cc7
3 files changed, 9 insertions, 6 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 7abf2be..95f30ab 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -519,8 +519,8 @@ int SocketStream::DoResolveHost() {
HostResolver::RequestInfo resolve_info(host_port_pair);
- DCHECK(host_resolver_.get());
- resolver_.reset(new SingleRequestHostResolver(host_resolver_.get()));
+ DCHECK(host_resolver_);
+ resolver_.reset(new SingleRequestHostResolver(host_resolver_));
return resolver_->Resolve(resolve_info, &addresses_, &io_callback_,
net_log_);
}
@@ -771,7 +771,7 @@ int SocketStream::DoSOCKSConnect() {
if (proxy_info_.proxy_server().scheme() == ProxyServer::SCHEME_SOCKS5)
s = new SOCKS5ClientSocket(s, req_info);
else
- s = new SOCKSClientSocket(s, req_info, host_resolver_.get());
+ s = new SOCKSClientSocket(s, req_info, host_resolver_);
socket_.reset(s);
metrics_->OnSOCKSProxy();
return socket_->Connect(&io_callback_);
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index aaf48de..e1f2584 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -273,7 +273,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
UserDataMap user_data_;
State next_state_;
- scoped_refptr<HostResolver> host_resolver_;
+ HostResolver* host_resolver_;
HttpAuthHandlerFactory* http_auth_handler_factory_;
ClientSocketFactory* factory_;
diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc
index d8e2093..497020d 100644
--- a/net/socket_stream/socket_stream_unittest.cc
+++ b/net/socket_stream/socket_stream_unittest.cc
@@ -238,11 +238,13 @@ TEST_F(SocketStreamTest, CloseFlushPendingWrite) {
delegate->SetOnReceivedData(NewCallback(
test, &SocketStreamTest::DoCloseFlushPendingWriteTest));
+ MockHostResolver host_resolver;
+
scoped_refptr<SocketStream> socket_stream =
new SocketStream(GURL("ws://example.com/demo"), delegate.get());
socket_stream->set_context(new TestURLRequestContext());
- socket_stream->SetHostResolver(new MockHostResolver());
+ socket_stream->SetHostResolver(&host_resolver);
MockWrite data_writes[] = {
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
@@ -333,7 +335,8 @@ TEST_F(SocketStreamTest, BasicAuthProxy) {
new SocketStream(GURL("ws://example.com/demo"), delegate.get());
socket_stream->set_context(new TestURLRequestContext("myproxy:70"));
- socket_stream->SetHostResolver(new MockHostResolver());
+ MockHostResolver host_resolver;
+ socket_stream->SetHostResolver(&host_resolver);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
socket_stream->Connect();