summaryrefslogtreecommitdiffstats
path: root/net/socket
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 00:24:51 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-04 00:24:51 +0000
commitd13c32787737f1822202802f062c41c38b90e5f5 (patch)
treef616a6dcf08fee7cc6f5c023e53be4fa501e9ef2 /net/socket
parent9becad4ad1adcd4e4339b45f8b90d299fd968a08 (diff)
downloadchromium_src-d13c32787737f1822202802f062c41c38b90e5f5.zip
chromium_src-d13c32787737f1822202802f062c41c38b90e5f5.tar.gz
chromium_src-d13c32787737f1822202802f062c41c38b90e5f5.tar.bz2
Pass the NetworkChangeNotifier to HostResolver.
This requires the following refactors: (1) NetworkChangeNotifier moves out of HttpNetworkSession into IOThread. (2) HostResolver gets initialized with NetworkChangeNotifier. (3) NetworkChangeNotifier needs to get passed into HttpCache and HttpNetworkSession (required updating a lot of files). (4) NetworkChangeNotifier is no longer reference counted. It is owned by IOThread. (5) IOThread gains a new struct: Globals. It can only be used on the io thread. (6) ChromeURLRequestContextFactory uses IOThread::Globals to initialize ChromeURLRequest objects with the host resolver and network change notifier. BUG=26159 Review URL: http://codereview.chromium.org/552117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38052 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r--net/socket/client_socket_pool_base.cc2
-rw-r--r--net/socket/client_socket_pool_base.h6
-rw-r--r--net/socket/ssl_client_socket_unittest.cc2
-rw-r--r--net/socket/ssl_test_util.cc3
-rw-r--r--net/socket/tcp_client_socket_pool.cc2
-rw-r--r--net/socket/tcp_client_socket_pool.h2
-rw-r--r--net/socket/tcp_client_socket_pool_unittest.cc7
-rw-r--r--net/socket/tcp_client_socket_unittest.cc2
-rw-r--r--net/socket/tcp_pinger_unittest.cc6
9 files changed, 17 insertions, 15 deletions
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 24c2dc6..4a5c88c 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -96,7 +96,7 @@ ClientSocketPoolBaseHelper::ClientSocketPoolBaseHelper(
base::TimeDelta unused_idle_socket_timeout,
base::TimeDelta used_idle_socket_timeout,
ConnectJobFactory* connect_job_factory,
- const scoped_refptr<NetworkChangeNotifier>& network_change_notifier)
+ NetworkChangeNotifier* network_change_notifier)
: idle_socket_count_(0),
connecting_socket_count_(0),
handed_out_socket_count_(0),
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h
index 8d3fba7..d4e9deb 100644
--- a/net/socket/client_socket_pool_base.h
+++ b/net/socket/client_socket_pool_base.h
@@ -168,7 +168,7 @@ class ClientSocketPoolBaseHelper
base::TimeDelta unused_idle_socket_timeout,
base::TimeDelta used_idle_socket_timeout,
ConnectJobFactory* connect_job_factory,
- const scoped_refptr<NetworkChangeNotifier>& network_change_notifier);
+ NetworkChangeNotifier* network_change_notifier);
// See ClientSocketPool::RequestSocket for documentation on this function.
// Note that |request| must be heap allocated. If ERR_IO_PENDING is returned,
@@ -383,7 +383,7 @@ class ClientSocketPoolBaseHelper
const scoped_ptr<ConnectJobFactory> connect_job_factory_;
- const scoped_refptr<NetworkChangeNotifier> network_change_notifier_;
+ NetworkChangeNotifier* const network_change_notifier_;
};
} // namespace internal
@@ -443,7 +443,7 @@ class ClientSocketPoolBase {
base::TimeDelta unused_idle_socket_timeout,
base::TimeDelta used_idle_socket_timeout,
ConnectJobFactory* connect_job_factory,
- const scoped_refptr<NetworkChangeNotifier>& network_change_notifier)
+ NetworkChangeNotifier* network_change_notifier)
: helper_(new internal::ClientSocketPoolBaseHelper(
max_sockets, max_sockets_per_group,
unused_idle_socket_timeout, used_idle_socket_timeout,
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index a3556dc..f44f1ab 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -25,7 +25,7 @@ const net::SSLConfig kDefaultSSLConfig;
class SSLClientSocketTest : public PlatformTest {
public:
SSLClientSocketTest()
- : resolver_(net::CreateSystemHostResolver()),
+ : resolver_(net::CreateSystemHostResolver(NULL)),
socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) {
}
diff --git a/net/socket/ssl_test_util.cc b/net/socket/ssl_test_util.cc
index 60b1f1f..941b693 100644
--- a/net/socket/ssl_test_util.cc
+++ b/net/socket/ssl_test_util.cc
@@ -309,7 +309,8 @@ bool TestServerLauncher::WaitToStart(const std::string& host_name, int port) {
// Verify that the webserver is actually started.
// Otherwise tests can fail if they run faster than Python can start.
net::AddressList addr;
- scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver());
+ scoped_refptr<net::HostResolver> resolver(
+ net::CreateSystemHostResolver(NULL));
net::HostResolver::RequestInfo info(host_name, port);
int rv = resolver->Resolve(info, &addr, NULL, NULL, NULL);
if (rv != net::OK)
diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc
index 823cce7..3ea6700 100644
--- a/net/socket/tcp_client_socket_pool.cc
+++ b/net/socket/tcp_client_socket_pool.cc
@@ -171,7 +171,7 @@ TCPClientSocketPool::TCPClientSocketPool(
int max_sockets_per_group,
HostResolver* host_resolver,
ClientSocketFactory* client_socket_factory,
- const scoped_refptr<NetworkChangeNotifier>& network_change_notifier)
+ NetworkChangeNotifier* network_change_notifier)
: base_(max_sockets, max_sockets_per_group,
base::TimeDelta::FromSeconds(kUnusedIdleSocketTimeout),
base::TimeDelta::FromSeconds(kUsedIdleSocketTimeout),
diff --git a/net/socket/tcp_client_socket_pool.h b/net/socket/tcp_client_socket_pool.h
index 6e36ec3..fb1a93b 100644
--- a/net/socket/tcp_client_socket_pool.h
+++ b/net/socket/tcp_client_socket_pool.h
@@ -83,7 +83,7 @@ class TCPClientSocketPool : public ClientSocketPool {
int max_sockets_per_group,
HostResolver* host_resolver,
ClientSocketFactory* client_socket_factory,
- const scoped_refptr<NetworkChangeNotifier>& network_change_notifier);
+ NetworkChangeNotifier* network_change_notifier);
// ClientSocketPool methods:
diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc
index 95b37f1..719d280 100644
--- a/net/socket/tcp_client_socket_pool_unittest.cc
+++ b/net/socket/tcp_client_socket_pool_unittest.cc
@@ -207,12 +207,11 @@ class TCPClientSocketPoolTest : public ClientSocketPoolTest {
TCPClientSocketPoolTest()
: ignored_request_info_("ignored", 80),
host_resolver_(new MockHostResolver),
- notifier_(new MockNetworkChangeNotifier),
pool_(new TCPClientSocketPool(kMaxSockets,
kMaxSocketsPerGroup,
host_resolver_,
&client_socket_factory_,
- notifier_)) {
+ &notifier_)) {
}
int StartRequest(const std::string& group_name, RequestPriority priority) {
@@ -223,7 +222,7 @@ class TCPClientSocketPoolTest : public ClientSocketPoolTest {
HostResolver::RequestInfo ignored_request_info_;
scoped_refptr<MockHostResolver> host_resolver_;
MockClientSocketFactory client_socket_factory_;
- scoped_refptr<MockNetworkChangeNotifier> notifier_;
+ MockNetworkChangeNotifier notifier_;
scoped_refptr<TCPClientSocketPool> pool_;
};
@@ -623,7 +622,7 @@ TEST_F(TCPClientSocketPoolTest, ResetIdleSocketsOnIPAddressChange) {
EXPECT_EQ(1, pool_->IdleSocketCount());
// After an IP address change, we should have 0 idle sockets.
- notifier_->NotifyIPAddressChange();
+ notifier_.NotifyIPAddressChange();
EXPECT_EQ(0, pool_->IdleSocketCount());
}
diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc
index eebdc9f..e1e08ab 100644
--- a/net/socket/tcp_client_socket_unittest.cc
+++ b/net/socket/tcp_client_socket_unittest.cc
@@ -88,7 +88,7 @@ void TCPClientSocketTest::SetUp() {
listen_port_ = port;
AddressList addr;
- scoped_refptr<HostResolver> resolver(CreateSystemHostResolver());
+ scoped_refptr<HostResolver> resolver(CreateSystemHostResolver(NULL));
HostResolver::RequestInfo info("localhost", listen_port_);
int rv = resolver->Resolve(info, &addr, NULL, NULL, NULL);
CHECK(rv == OK);
diff --git a/net/socket/tcp_pinger_unittest.cc b/net/socket/tcp_pinger_unittest.cc
index 1714ebe..2cffa8a 100644
--- a/net/socket/tcp_pinger_unittest.cc
+++ b/net/socket/tcp_pinger_unittest.cc
@@ -65,7 +65,8 @@ void TCPPingerTest::SetUp() {
TEST_F(TCPPingerTest, Ping) {
net::AddressList addr;
- scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver());
+ scoped_refptr<net::HostResolver> resolver(
+ net::CreateSystemHostResolver(NULL));
net::HostResolver::RequestInfo info("localhost", listen_port_);
int rv = resolver->Resolve(info, &addr, NULL, NULL, NULL);
@@ -78,7 +79,8 @@ TEST_F(TCPPingerTest, Ping) {
TEST_F(TCPPingerTest, PingFail) {
net::AddressList addr;
- scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver());
+ scoped_refptr<net::HostResolver> resolver(
+ net::CreateSystemHostResolver(NULL));
// "Kill" "server"
listen_sock_ = NULL;