diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 00:25:12 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 00:25:12 +0000 |
commit | ec08bb23238e41b66daa676c3c55f23544a0de14 (patch) | |
tree | aef939a8d5cccb67d037d8d055380a82e95bbfaa /net/socket | |
parent | db471b330fc82a9f450807ec1f4307c29dda23c4 (diff) | |
download | chromium_src-ec08bb23238e41b66daa676c3c55f23544a0de14.zip chromium_src-ec08bb23238e41b66daa676c3c55f23544a0de14.tar.gz chromium_src-ec08bb23238e41b66daa676c3c55f23544a0de14.tar.bz2 |
Add a "LoadLog" parameter to transactions, hostresolver, clientsocketpool and proyxservice.This dependency comes from the parent URLRequest, and is used as a container for per-request profiling data.This change is strictly a no-op refactor -- the parameter is unused, and LoadLog does nothing.BUG=http://crbug.com/14478TEST=none -- just needs to compile and pass existing tests.DESIGN=<http://docs.google.com/Doc?id=dfhcnb2v_21gbtrcpr3&hl=en>
Review URL: http://codereview.chromium.org/126303
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/client_socket_handle.cc | 5 | ||||
-rw-r--r-- | net/socket/client_socket_handle.h | 4 | ||||
-rw-r--r-- | net/socket/client_socket_pool.h | 4 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base.cc | 7 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base.h | 12 | ||||
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 117 | ||||
-rw-r--r-- | net/socket/socket_test_util.cc | 4 | ||||
-rw-r--r-- | net/socket/socks5_client_socket.cc | 3 | ||||
-rw-r--r-- | net/socket/socks5_client_socket_unittest.cc | 2 | ||||
-rw-r--r-- | net/socket/socks_client_socket.cc | 3 | ||||
-rw-r--r-- | net/socket/socks_client_socket_unittest.cc | 1 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_unittest.cc | 12 | ||||
-rw-r--r-- | net/socket/ssl_test_util.cc | 2 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_pool.cc | 5 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_pool.h | 3 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_pool_unittest.cc | 28 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_unittest.cc | 2 | ||||
-rw-r--r-- | net/socket/tcp_pinger_unittest.cc | 4 |
18 files changed, 123 insertions, 95 deletions
diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc index 384d205..6c12f70 100644 --- a/net/socket/client_socket_handle.cc +++ b/net/socket/client_socket_handle.cc @@ -23,7 +23,8 @@ ClientSocketHandle::~ClientSocketHandle() { Reset(); } -int ClientSocketHandle::Init(const std::string& group_name, +int ClientSocketHandle::Init(LoadLog* load_log, + const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, CompletionCallback* callback) { @@ -31,7 +32,7 @@ int ClientSocketHandle::Init(const std::string& group_name, ResetInternal(true); group_name_ = group_name; int rv = pool_->RequestSocket( - group_name, resolve_info, priority, this, &callback_); + load_log, group_name, resolve_info, priority, this, &callback_); if (rv == ERR_IO_PENDING) { user_callback_ = callback; } else { diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h index 9235e71..f1d85899 100644 --- a/net/socket/client_socket_handle.h +++ b/net/socket/client_socket_handle.h @@ -46,7 +46,9 @@ class ClientSocketHandle { // // Init may be called multiple times. // - int Init(const std::string& group_name, + // Profiling information for the request is saved to |load_log| if non-NULL. + int Init(LoadLog* load_log, + const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, CompletionCallback* callback); diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h index 1c8b30e..b6a740d 100644 --- a/net/socket/client_socket_pool.h +++ b/net/socket/client_socket_pool.h @@ -46,7 +46,9 @@ class ClientSocketPool : public base::RefCounted<ClientSocketPool> { // If ERR_IO_PENDING is returned, then the callback will be used to notify the // client of completion. // - virtual int RequestSocket(const std::string& group_name, + // Profiling information for the request is saved to |load_log| if non-NULL. + virtual int RequestSocket(LoadLog* load_log, + const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, ClientSocketHandle* handle, diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index ec32383..4261c55 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -103,6 +103,7 @@ void ClientSocketPoolBase::InsertRequestIntoQueue( } int ClientSocketPoolBase::RequestSocket( + LoadLog* load_log, const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, @@ -122,7 +123,7 @@ int ClientSocketPoolBase::RequestSocket( may_have_stalled_group_ = true; } CHECK(callback); - Request r(handle, callback, priority, resolve_info); + Request r(load_log, handle, callback, priority, resolve_info); InsertRequestIntoQueue(r, &group.pending_requests); return ERR_IO_PENDING; } @@ -142,7 +143,7 @@ int ClientSocketPoolBase::RequestSocket( // We couldn't find a socket to reuse, so allocate and connect a new one. CHECK(callback); - Request r(handle, callback, priority, resolve_info); + Request r(load_log, handle, callback, priority, resolve_info); scoped_ptr<ConnectJob> connect_job( connect_job_factory_->NewConnectJob(group_name, r, this)); @@ -498,7 +499,7 @@ void ClientSocketPoolBase::ProcessPendingRequest(const std::string& group_name, group->pending_requests.pop_front(); int rv = RequestSocket( - group_name, r.resolve_info, r.priority, r.handle, r.callback); + r.load_log, group_name, r.resolve_info, r.priority, r.handle, r.callback); if (rv != ERR_IO_PENDING) { r.callback->Run(rv); diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 51b2139..762c0ed 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -17,6 +17,7 @@ #include "net/base/address_list.h" #include "net/base/completion_callback.h" #include "net/base/host_resolver.h" +#include "net/base/load_log.h" #include "net/base/load_states.h" #include "net/socket/client_socket.h" #include "net/socket/client_socket_pool.h" @@ -109,14 +110,16 @@ class ClientSocketPoolBase priority(0), resolve_info(std::string(), 0) {} - Request(ClientSocketHandle* handle, + Request(LoadLog* load_log, + ClientSocketHandle* handle, CompletionCallback* callback, int priority, const HostResolver::RequestInfo& resolve_info) - : handle(handle), callback(callback), priority(priority), - resolve_info(resolve_info) { + : load_log(load_log), handle(handle), callback(callback), + priority(priority), resolve_info(resolve_info) { } + scoped_refptr<LoadLog> load_log; ClientSocketHandle* handle; CompletionCallback* callback; int priority; @@ -143,7 +146,8 @@ class ClientSocketPoolBase ~ClientSocketPoolBase(); - int RequestSocket(const std::string& group_name, + int RequestSocket(LoadLog* load_log, + const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, ClientSocketHandle* handle, diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index dd417ae..3139b27 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -248,13 +248,14 @@ class TestClientSocketPool : public ClientSocketPool { max_sockets, max_sockets_per_group, connect_job_factory)) {} virtual int RequestSocket( + LoadLog* load_log, const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, ClientSocketHandle* handle, CompletionCallback* callback) { return base_->RequestSocket( - group_name, resolve_info, priority, handle, callback); + NULL, group_name, resolve_info, priority, handle, callback); } virtual void CancelRequest( @@ -384,7 +385,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_NoTimeoutOnSynchronousCompletion) { request.handle = &ignored; scoped_ptr<TestConnectJob> job( new TestConnectJob(TestConnectJob::kMockJob, - "a", + "a", request, base::TimeDelta::FromMicroseconds(1), &delegate, @@ -400,7 +401,7 @@ TEST_F(ClientSocketPoolBaseTest, ConnectJob_TimedOut) { // Deleted by TestConnectJobDelegate. TestConnectJob* job = new TestConnectJob(TestConnectJob::kMockPendingJob, - "a", + "a", request, base::TimeDelta::FromMicroseconds(1), &delegate, @@ -415,8 +416,8 @@ TEST_F(ClientSocketPoolBaseTest, BasicSynchronous) { TestCompletionCallback callback; ClientSocketHandle handle(pool_.get()); - EXPECT_EQ(OK, handle.Init("a", ignored_request_info_, kDefaultPriority, - &callback)); + EXPECT_EQ(OK, handle.Init(NULL, "a", ignored_request_info_, + kDefaultPriority, &callback)); EXPECT_TRUE(handle.is_initialized()); EXPECT_TRUE(handle.socket()); handle.Reset(); @@ -427,7 +428,7 @@ TEST_F(ClientSocketPoolBaseTest, BasicAsynchronous) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); - int rv = req.handle()->Init("a", ignored_request_info_, 0, &req); + int rv = req.handle()->Init(NULL, "a", ignored_request_info_, 0, &req); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); EXPECT_EQ(OK, req.WaitForResult()); @@ -442,7 +443,7 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionFailure) { connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_CONNECTION_FAILED, - req.handle()->Init("a", ignored_request_info_, + req.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req)); } @@ -452,8 +453,8 @@ TEST_F(ClientSocketPoolBaseTest, InitConnectionAsynchronousFailure) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", ignored_request_info_, kDefaultPriority, - &req)); + req.handle()->Init(NULL, "a", ignored_request_info_, + kDefaultPriority, &req)); EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); EXPECT_EQ(ERR_CONNECTION_FAILED, req.WaitForResult()); } @@ -744,7 +745,7 @@ TEST_F(ClientSocketPoolBaseTest, CancelRequestClearGroup) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", ignored_request_info_, + req.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req)); req.handle()->Reset(); } @@ -757,10 +758,10 @@ TEST_F(ClientSocketPoolBaseTest, TwoRequestsCancelOne) { TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", ignored_request_info_, + req.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req)); EXPECT_EQ(ERR_IO_PENDING, - req2.handle()->Init("a", ignored_request_info_, + req2.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req2)); req.handle()->Reset(); @@ -778,14 +779,14 @@ TEST_F(ClientSocketPoolBaseTest, ConnectCancelConnect) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - handle.Init("a", ignored_request_info_, + handle.Init(NULL, "a", ignored_request_info_, kDefaultPriority, &callback)); handle.Reset(); TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, - handle.Init("a", ignored_request_info_, + handle.Init(NULL, "a", ignored_request_info_, kDefaultPriority, &callback2)); EXPECT_EQ(OK, callback2.WaitForResult()); @@ -848,7 +849,7 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { handle_->Reset(); within_callback_ = true; int rv = handle_->Init( - "a", HostResolver::RequestInfo("www.google.com", 80), + NULL, "a", HostResolver::RequestInfo("www.google.com", 80), kDefaultPriority, this); switch (next_job_type_) { case TestConnectJob::kMockJob: @@ -884,7 +885,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestPendingJobTwice) { RequestSocketCallback callback( &handle, connect_job_factory_, TestConnectJob::kMockPendingJob); int rv = handle.Init( - "a", ignored_request_info_, kDefaultPriority, &callback); + NULL, "a", ignored_request_info_, kDefaultPriority, &callback); ASSERT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); @@ -899,7 +900,7 @@ TEST_F(ClientSocketPoolBaseTest, RequestPendingJobThenSynchronous) { RequestSocketCallback callback( &handle, connect_job_factory_, TestConnectJob::kMockJob); int rv = handle.Init( - "a", ignored_request_info_, kDefaultPriority, &callback); + NULL, "a", ignored_request_info_, kDefaultPriority, &callback); ASSERT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); @@ -962,13 +963,14 @@ TEST_F(ClientSocketPoolBaseTest, CancelActiveRequestThenRequestSocket) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); int rv = req.handle()->Init( - "a", ignored_request_info_, kDefaultPriority, &req); + NULL, "a", ignored_request_info_, kDefaultPriority, &req); EXPECT_EQ(ERR_IO_PENDING, rv); // Cancel the active request. req.handle()->Reset(); - rv = req.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req); + rv = req.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, req.WaitForResult()); @@ -988,13 +990,14 @@ TEST_F(ClientSocketPoolBaseTest, PendingJobCompletionOrder) { // Start job 1 (async error). TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); - int rv = req1.handle()->Init("a", ignored_request_info_, + int rv = req1.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req1); EXPECT_EQ(ERR_IO_PENDING, rv); // Start job 2 (async error). TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); - rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); + rv = req2.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req2); EXPECT_EQ(ERR_IO_PENDING, rv); // The pending job is sync. @@ -1002,7 +1005,8 @@ TEST_F(ClientSocketPoolBaseTest, PendingJobCompletionOrder) { // Request 3 does not have a ConnectJob yet. It's just pending. TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); - rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); + rv = req3.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req3); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(ERR_CONNECTION_FAILED, req1.WaitForResult()); @@ -1029,8 +1033,8 @@ TEST_F(ClientSocketPoolBaseTest, ReleaseSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); - int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, - &req1); + int rv = req1.handle()->Init(NULL, "a", ignored_request_info_, + kDefaultPriority, &req1); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, req1.WaitForResult()); @@ -1038,7 +1042,8 @@ TEST_F(ClientSocketPoolBaseTest, ReleaseSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); - rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); + rv = req2.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req2); EXPECT_EQ(ERR_IO_PENDING, rv); req1.handle()->Reset(); MessageLoop::current()->RunAllPending(); // Run the DoReleaseSocket() @@ -1047,7 +1052,8 @@ TEST_F(ClientSocketPoolBaseTest, ReleaseSockets) { // will use the idle socket). TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); - rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); + rv = req3.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req3); EXPECT_EQ(OK, rv); EXPECT_FALSE(req2.handle()->socket()); @@ -1113,7 +1119,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, request.handle = &ignored; scoped_ptr<TestConnectJob> job( new TestConnectJob(TestConnectJob::kMockJob, - "a", + "a", request, base::TimeDelta::FromMicroseconds(1), &delegate, @@ -1129,7 +1135,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, ConnectJob_TimedOut) { // Deleted by TestConnectJobDelegate. TestConnectJob* job = new TestConnectJob(TestConnectJob::kMockPendingJob, - "a", + "a", request, base::TimeDelta::FromMicroseconds(1), &delegate, @@ -1144,7 +1150,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, BasicSynchronous) { TestCompletionCallback callback; ClientSocketHandle handle(pool_.get()); - EXPECT_EQ(OK, handle.Init("a", ignored_request_info_, kDefaultPriority, + EXPECT_EQ(OK, handle.Init(NULL, "a", ignored_request_info_, kDefaultPriority, &callback)); EXPECT_TRUE(handle.is_initialized()); EXPECT_TRUE(handle.socket()); @@ -1156,7 +1162,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, BasicAsynchronous) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); - int rv = req.handle()->Init("a", ignored_request_info_, 0, &req); + int rv = req.handle()->Init(NULL, "a", ignored_request_info_, 0, &req); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); EXPECT_EQ(OK, req.WaitForResult()); @@ -1171,7 +1177,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, InitConnectionFailure) { connect_job_factory_->set_job_type(TestConnectJob::kMockFailingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_CONNECTION_FAILED, - req.handle()->Init("a", ignored_request_info_, + req.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req)); } @@ -1182,8 +1188,8 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", ignored_request_info_, kDefaultPriority, - &req)); + req.handle()->Init(NULL, "a", ignored_request_info_, + kDefaultPriority, &req)); EXPECT_EQ(LOAD_STATE_CONNECTING, pool_->GetLoadState("a", req.handle())); EXPECT_EQ(ERR_CONNECTION_FAILED, req.WaitForResult()); } @@ -1247,7 +1253,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, CancelRequestClearGroup) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", ignored_request_info_, + req.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req)); req.handle()->Reset(); } @@ -1260,10 +1266,10 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, TwoRequestsCancelOne) { TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", ignored_request_info_, + req.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req)); EXPECT_EQ(ERR_IO_PENDING, - req2.handle()->Init("a", ignored_request_info_, + req2.handle()->Init(NULL, "a", ignored_request_info_, kDefaultPriority, &req2)); req.handle()->Reset(); @@ -1281,14 +1287,14 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, ConnectCancelConnect) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); EXPECT_EQ(ERR_IO_PENDING, - handle.Init("a", ignored_request_info_, + handle.Init(NULL, "a", ignored_request_info_, kDefaultPriority, &callback)); handle.Reset(); TestCompletionCallback callback2; EXPECT_EQ(ERR_IO_PENDING, - handle.Init("a", ignored_request_info_, + handle.Init(NULL, "a", ignored_request_info_, kDefaultPriority, &callback2)); EXPECT_EQ(OK, callback2.WaitForResult()); @@ -1362,7 +1368,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, RequestPendingJobTwice) { RequestSocketCallback callback( &handle, connect_job_factory_, TestConnectJob::kMockPendingJob); int rv = handle.Init( - "a", ignored_request_info_, kDefaultPriority, &callback); + NULL, "a", ignored_request_info_, kDefaultPriority, &callback); ASSERT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); @@ -1377,7 +1383,7 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, RequestPendingJobThenSynchronous) { RequestSocketCallback callback( &handle, connect_job_factory_, TestConnectJob::kMockJob); int rv = handle.Init( - "a", ignored_request_info_, kDefaultPriority, &callback); + NULL, "a", ignored_request_info_, kDefaultPriority, &callback); ASSERT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, callback.WaitForResult()); @@ -1443,13 +1449,14 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); int rv = req.handle()->Init( - "a", ignored_request_info_, kDefaultPriority, &req); + NULL, "a", ignored_request_info_, kDefaultPriority, &req); EXPECT_EQ(ERR_IO_PENDING, rv); // Cancel the active request. req.handle()->Reset(); - rv = req.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req); + rv = req.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, req.WaitForResult()); @@ -1467,8 +1474,8 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, ReleaseSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); - int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, - &req1); + int rv = req1.handle()->Init(NULL, "a", ignored_request_info_, + kDefaultPriority, &req1); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(OK, req1.WaitForResult()); @@ -1477,10 +1484,12 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, ReleaseSockets) { connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); - rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); + rv = req2.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req2); EXPECT_EQ(ERR_IO_PENDING, rv); TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); - rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); + rv = req3.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req3); EXPECT_EQ(ERR_IO_PENDING, rv); // Both Requests 2 and 3 are pending. We release socket 1 which should @@ -1511,18 +1520,21 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, PendingJobCompletionOrder) { connect_job_factory_->set_job_type(TestConnectJob::kMockPendingFailingJob); TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); - int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req1); + int rv = req1.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req1); EXPECT_EQ(ERR_IO_PENDING, rv); TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); - rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); + rv = req2.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req2); EXPECT_EQ(ERR_IO_PENDING, rv); // The pending job is sync. connect_job_factory_->set_job_type(TestConnectJob::kMockJob); TestSocketRequest req3(pool_.get(), &request_order_, &completion_count_); - rv = req3.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req3); + rv = req3.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req3); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(ERR_CONNECTION_FAILED, req1.WaitForResult()); @@ -1541,15 +1553,16 @@ TEST_F(ClientSocketPoolBaseTest_LateBinding, DISABLED_LoadState) { TestConnectJob::kMockAdvancingLoadStateJob); TestSocketRequest req1(pool_.get(), &request_order_, &completion_count_); - int rv = req1.handle()->Init("a", ignored_request_info_, kDefaultPriority, - &req1); + int rv = req1.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req1); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(LOAD_STATE_IDLE, req1.handle()->GetLoadState()); MessageLoop::current()->RunAllPending(); TestSocketRequest req2(pool_.get(), &request_order_, &completion_count_); - rv = req2.handle()->Init("a", ignored_request_info_, kDefaultPriority, &req2); + rv = req2.handle()->Init( + NULL, "a", ignored_request_info_, kDefaultPriority, &req2); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, req1.handle()->GetLoadState()); EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, req2.handle()->GetLoadState()); diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 2b49685..0f61714 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -337,8 +337,8 @@ int ClientSocketPoolTest::StartRequestUsingPool(ClientSocketPool* socket_pool, &request_order_, &completion_count_); requests_.push_back(request); - int rv = request->handle()->Init(group_name, ignored_request_info_, priority, - request); + int rv = request->handle()->Init(NULL, group_name, ignored_request_info_, + priority, request); if (rv != ERR_IO_PENDING) request_order_.push_back(request); return rv; diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc index 8876bb9..bb058cb 100644 --- a/net/socket/socks5_client_socket.cc +++ b/net/socket/socks5_client_socket.cc @@ -176,7 +176,8 @@ int SOCKS5ClientSocket::DoResolveHost() { DCHECK_EQ(kEndPointUnresolved, address_type_); next_state_ = STATE_RESOLVE_HOST_COMPLETE; - return host_resolver_.Resolve(host_request_info_, &addresses_, &io_callback_); + return host_resolver_.Resolve( + NULL, host_request_info_, &addresses_, &io_callback_); } int SOCKS5ClientSocket::DoResolveHostComplete(int result) { diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index 33b3fa3..3ad5bab 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -59,7 +59,7 @@ void SOCKS5ClientSocketTest::SetUp() { // Resolve the "localhost" AddressList used by the TCP connection to connect. HostResolver::RequestInfo info("www.socks-proxy.com", 1080); - int rv = host_resolver_->Resolve(info, &address_list_, NULL, NULL); + int rv = host_resolver_->Resolve(NULL, info, &address_list_, NULL, NULL); ASSERT_EQ(OK, rv); } diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index 3575729..8b08dc1 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc @@ -196,7 +196,8 @@ int SOCKSClientSocket::DoResolveHost() { DCHECK_EQ(kSOCKS4Unresolved, socks_version_); next_state_ = STATE_RESOLVE_HOST_COMPLETE; - return host_resolver_.Resolve(host_request_info_, &addresses_, &io_callback_); + return host_resolver_.Resolve( + NULL, host_request_info_, &addresses_, &io_callback_); } int SOCKSClientSocket::DoResolveHostComplete(int result) { diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 32eb725..7bb7ab7 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -5,7 +5,6 @@ #include "net/socket/socks_client_socket.h" #include "net/base/address_list.h" -#include "net/base/listen_socket.h" #include "net/base/mock_host_resolver.h" #include "net/base/test_completion_callback.h" #include "net/base/winsock_init.h" diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index e0520e5..cb8efe1 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -91,7 +91,7 @@ TEST_F(SSLClientSocketTest, MAYBE_Connect) { TestCompletionCallback callback; net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); - int rv = resolver_->Resolve(info, &addr, NULL, NULL); + int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(net::OK, rv); net::ClientSocket *transport = new net::TCPClientSocket(addr); @@ -128,7 +128,7 @@ TEST_F(SSLClientSocketTest, MAYBE_ConnectExpired) { TestCompletionCallback callback; net::HostResolver::RequestInfo info(server_.kHostName, server_.kBadHTTPSPort); - int rv = resolver_->Resolve(info, &addr, NULL, NULL); + int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(net::OK, rv); net::ClientSocket *transport = new net::TCPClientSocket(addr); @@ -165,7 +165,7 @@ TEST_F(SSLClientSocketTest, MAYBE_ConnectMismatched) { net::HostResolver::RequestInfo info(server_.kMismatchedHostName, server_.kOKHTTPSPort); - int rv = resolver_->Resolve(info, &addr, NULL, NULL); + int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(net::OK, rv); net::ClientSocket *transport = new net::TCPClientSocket(addr); @@ -206,7 +206,7 @@ TEST_F(SSLClientSocketTest, MAYBE_Read) { TestCompletionCallback callback; net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); - int rv = resolver_->Resolve(info, &addr, &callback, NULL); + int rv = resolver_->Resolve(NULL, info, &addr, &callback, NULL); EXPECT_EQ(net::ERR_IO_PENDING, rv); rv = callback.WaitForResult(); @@ -266,7 +266,7 @@ TEST_F(SSLClientSocketTest, MAYBE_Read_SmallChunks) { TestCompletionCallback callback; net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); - int rv = resolver_->Resolve(info, &addr, NULL, NULL); + int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(net::OK, rv); net::ClientSocket *transport = new net::TCPClientSocket(addr); @@ -321,7 +321,7 @@ TEST_F(SSLClientSocketTest, MAYBE_Read_Interrupted) { TestCompletionCallback callback; net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); - int rv = resolver_->Resolve(info, &addr, NULL, NULL); + int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(net::OK, rv); net::ClientSocket *transport = new net::TCPClientSocket(addr); diff --git a/net/socket/ssl_test_util.cc b/net/socket/ssl_test_util.cc index 649b27d..298db77 100644 --- a/net/socket/ssl_test_util.cc +++ b/net/socket/ssl_test_util.cc @@ -266,7 +266,7 @@ bool TestServerLauncher::WaitToStart(const std::string& host_name, int port) { net::AddressList addr; scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver()); net::HostResolver::RequestInfo info(host_name, port); - int rv = resolver->Resolve(info, &addr, NULL, NULL); + int rv = resolver->Resolve(NULL, info, &addr, NULL, NULL); if (rv != net::OK) return false; diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc index 197ccdb..46aab4d 100644 --- a/net/socket/tcp_client_socket_pool.cc +++ b/net/socket/tcp_client_socket_pool.cc @@ -89,7 +89,7 @@ int TCPConnectJob::DoLoop(int result) { int TCPConnectJob::DoResolveHost() { set_load_state(LOAD_STATE_RESOLVING_HOST); next_state_ = kStateResolveHostComplete; - return resolver_.Resolve(resolve_info_, &addresses_, &callback_); + return resolver_.Resolve(NULL, resolve_info_, &addresses_, &callback_); } int TCPConnectJob::DoResolveHostComplete(int result) { @@ -149,13 +149,14 @@ TCPClientSocketPool::TCPClientSocketPool( TCPClientSocketPool::~TCPClientSocketPool() {} int TCPClientSocketPool::RequestSocket( + LoadLog* load_log, const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, ClientSocketHandle* handle, CompletionCallback* callback) { return base_->RequestSocket( - group_name, resolve_info, priority, handle, callback); + load_log, group_name, resolve_info, priority, handle, callback); } void TCPClientSocketPool::CancelRequest( diff --git a/net/socket/tcp_client_socket_pool.h b/net/socket/tcp_client_socket_pool.h index b07ea68..55a2f63 100644 --- a/net/socket/tcp_client_socket_pool.h +++ b/net/socket/tcp_client_socket_pool.h @@ -80,7 +80,8 @@ class TCPClientSocketPool : public ClientSocketPool { // ClientSocketPool methods: - virtual int RequestSocket(const std::string& group_name, + virtual int RequestSocket(LoadLog* load_log, + const std::string& group_name, const HostResolver::RequestInfo& resolve_info, int priority, ClientSocketHandle* handle, diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc index ad7cb16..649790a 100644 --- a/net/socket/tcp_client_socket_pool_unittest.cc +++ b/net/socket/tcp_client_socket_pool_unittest.cc @@ -209,7 +209,7 @@ TEST_F(TCPClientSocketPoolTest, Basic) { TestCompletionCallback callback; ClientSocketHandle handle(pool_.get()); HostResolver::RequestInfo info("www.google.com", 80); - int rv = handle.Init("a", info, 0, &callback); + int rv = handle.Init(NULL, "a", info, 0, &callback); EXPECT_EQ(ERR_IO_PENDING, rv); EXPECT_FALSE(handle.is_initialized()); EXPECT_FALSE(handle.socket()); @@ -226,7 +226,7 @@ TEST_F(TCPClientSocketPoolTest, InitHostResolutionFailure) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); HostResolver::RequestInfo info("unresolvable.host.name", 80); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", info, kDefaultPriority, &req)); + req.handle()->Init(NULL, "a", info, kDefaultPriority, &req)); EXPECT_EQ(ERR_NAME_NOT_RESOLVED, req.WaitForResult()); } @@ -236,13 +236,13 @@ TEST_F(TCPClientSocketPoolTest, InitConnectionFailure) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); HostResolver::RequestInfo info("a", 80); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", info, kDefaultPriority, &req)); + req.handle()->Init(NULL, "a", info, kDefaultPriority, &req)); EXPECT_EQ(ERR_CONNECTION_FAILED, req.WaitForResult()); // Make the host resolutions complete synchronously this time. host_resolver_->set_synchronous_mode(true); EXPECT_EQ(ERR_CONNECTION_FAILED, - req.handle()->Init("a", info, kDefaultPriority, &req)); + req.handle()->Init(NULL, "a", info, kDefaultPriority, &req)); } TEST_F(TCPClientSocketPoolTest, PendingRequests) { @@ -348,7 +348,7 @@ TEST_F(TCPClientSocketPoolTest, CancelRequestClearGroup) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); HostResolver::RequestInfo info("www.google.com", 80); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", info, kDefaultPriority, &req)); + req.handle()->Init(NULL, "a", info, kDefaultPriority, &req)); req.handle()->Reset(); PlatformThread::Sleep(100); @@ -367,9 +367,9 @@ TEST_F(TCPClientSocketPoolTest, TwoRequestsCancelOne) { HostResolver::RequestInfo info("www.google.com", 80); EXPECT_EQ(ERR_IO_PENDING, - req.handle()->Init("a", info, kDefaultPriority, &req)); + req.handle()->Init(NULL, "a", info, kDefaultPriority, &req)); EXPECT_EQ(ERR_IO_PENDING, - req2.handle()->Init("a", info, kDefaultPriority, &req2)); + req2.handle()->Init(NULL, "a", info, kDefaultPriority, &req2)); req.handle()->Reset(); @@ -385,12 +385,14 @@ TEST_F(TCPClientSocketPoolTest, ConnectCancelConnect) { TestSocketRequest req(pool_.get(), &request_order_, &completion_count_); HostResolver::RequestInfo info("www.google.com", 80); - EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", info, kDefaultPriority, &callback)); + EXPECT_EQ(ERR_IO_PENDING, + handle.Init(NULL, "a", info, kDefaultPriority, &callback)); handle.Reset(); TestCompletionCallback callback2; - EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", info, kDefaultPriority, &callback2)); + EXPECT_EQ(ERR_IO_PENDING, + handle.Init(NULL, "a", info, kDefaultPriority, &callback2)); host_resolver_->set_synchronous_mode(true); // At this point, handle has two ConnectingSockets out for it. Due to the @@ -479,8 +481,8 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { if (!within_callback_) { handle_->Reset(); within_callback_ = true; - int rv = handle_->Init( - "a", HostResolver::RequestInfo("www.google.com", 80), 0, this); + int rv = handle_->Init(NULL, "a", + HostResolver::RequestInfo("www.google.com", 80), 0, this); EXPECT_EQ(OK, rv); } } @@ -498,8 +500,8 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { TEST_F(TCPClientSocketPoolTest, RequestTwice) { ClientSocketHandle handle(pool_.get()); RequestSocketCallback callback(&handle); - int rv = handle.Init( - "a", HostResolver::RequestInfo("www.google.com", 80), 0, &callback); + int rv = handle.Init(NULL, "a", + HostResolver::RequestInfo("www.google.com", 80), 0, &callback); ASSERT_EQ(ERR_IO_PENDING, rv); // The callback is going to request "www.google.com". We want it to complete diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc index 6d14694..c2a8495 100644 --- a/net/socket/tcp_client_socket_unittest.cc +++ b/net/socket/tcp_client_socket_unittest.cc @@ -88,7 +88,7 @@ void TCPClientSocketTest::SetUp() { AddressList addr; scoped_refptr<HostResolver> resolver(CreateSystemHostResolver()); HostResolver::RequestInfo info("localhost", listen_port_); - int rv = resolver->Resolve(info, &addr, NULL, NULL); + int rv = resolver->Resolve(NULL, info, &addr, NULL, NULL); CHECK(rv == OK); sock_.reset(new TCPClientSocket(addr)); } diff --git a/net/socket/tcp_pinger_unittest.cc b/net/socket/tcp_pinger_unittest.cc index b1e678f..0ca1138 100644 --- a/net/socket/tcp_pinger_unittest.cc +++ b/net/socket/tcp_pinger_unittest.cc @@ -68,7 +68,7 @@ TEST_F(TCPPingerTest, Ping) { scoped_refptr<net::HostResolver> resolver(net::CreateSystemHostResolver()); net::HostResolver::RequestInfo info("localhost", listen_port_); - int rv = resolver->Resolve(info, &addr, NULL, NULL); + int rv = resolver->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(rv, net::OK); net::TCPPinger pinger(addr); @@ -84,7 +84,7 @@ TEST_F(TCPPingerTest, PingFail) { listen_sock_ = NULL; net::HostResolver::RequestInfo info("localhost", listen_port_); - int rv = resolver->Resolve(info, &addr, NULL, NULL); + int rv = resolver->Resolve(NULL, info, &addr, NULL, NULL); EXPECT_EQ(rv, net::OK); net::TCPPinger pinger(addr); |