summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-12 00:25:12 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-12 00:25:12 +0000
commitec08bb23238e41b66daa676c3c55f23544a0de14 (patch)
treeaef939a8d5cccb67d037d8d055380a82e95bbfaa /net
parentdb471b330fc82a9f450807ec1f4307c29dda23c4 (diff)
downloadchromium_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')
-rw-r--r--net/base/host_resolver.cc6
-rw-r--r--net/base/host_resolver.h16
-rw-r--r--net/base/host_resolver_impl.cc3
-rw-r--r--net/base/host_resolver_impl.h7
-rw-r--r--net/base/host_resolver_impl_unittest.cc30
-rw-r--r--net/base/load_log.h24
-rw-r--r--net/base/mock_host_resolver.cc5
-rw-r--r--net/base/mock_host_resolver.h7
-rw-r--r--net/ftp/ftp_network_transaction.cc9
-rw-r--r--net/ftp/ftp_network_transaction.h4
-rw-r--r--net/ftp/ftp_network_transaction_unittest.cc6
-rw-r--r--net/ftp/ftp_transaction.h5
-rw-r--r--net/http/http_cache.cc16
-rw-r--r--net/http/http_cache_unittest.cc28
-rw-r--r--net/http/http_network_layer_unittest.cc2
-rw-r--r--net/http/http_network_transaction.cc12
-rw-r--r--net/http/http_network_transaction.h4
-rw-r--r--net/http/http_network_transaction_unittest.cc100
-rw-r--r--net/http/http_transaction.h5
-rw-r--r--net/http/http_transaction_unittest.h7
-rw-r--r--net/net.gyp1
-rw-r--r--net/proxy/proxy_resolver_js_bindings.cc5
-rw-r--r--net/proxy/proxy_service.cc31
-rw-r--r--net/proxy/proxy_service.h20
-rw-r--r--net/proxy/proxy_service_unittest.cc141
-rw-r--r--net/socket/client_socket_handle.cc5
-rw-r--r--net/socket/client_socket_handle.h4
-rw-r--r--net/socket/client_socket_pool.h4
-rw-r--r--net/socket/client_socket_pool_base.cc7
-rw-r--r--net/socket/client_socket_pool_base.h12
-rw-r--r--net/socket/client_socket_pool_base_unittest.cc117
-rw-r--r--net/socket/socket_test_util.cc4
-rw-r--r--net/socket/socks5_client_socket.cc3
-rw-r--r--net/socket/socks5_client_socket_unittest.cc2
-rw-r--r--net/socket/socks_client_socket.cc3
-rw-r--r--net/socket/socks_client_socket_unittest.cc1
-rw-r--r--net/socket/ssl_client_socket_unittest.cc12
-rw-r--r--net/socket/ssl_test_util.cc2
-rw-r--r--net/socket/tcp_client_socket_pool.cc5
-rw-r--r--net/socket/tcp_client_socket_pool.h3
-rw-r--r--net/socket/tcp_client_socket_pool_unittest.cc28
-rw-r--r--net/socket/tcp_client_socket_unittest.cc2
-rw-r--r--net/socket/tcp_pinger_unittest.cc4
-rw-r--r--net/tools/fetch/fetch_client.cc3
-rw-r--r--net/url_request/url_request.cc4
-rw-r--r--net/url_request/url_request.h10
-rw-r--r--net/url_request/url_request_http_job.cc3
-rw-r--r--net/url_request/url_request_new_ftp_job.cc3
48 files changed, 430 insertions, 305 deletions
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index 1d17296..4208492 100644
--- a/net/base/host_resolver.cc
+++ b/net/base/host_resolver.cc
@@ -25,7 +25,8 @@ SingleRequestHostResolver::~SingleRequestHostResolver() {
}
}
-int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info,
+int SingleRequestHostResolver::Resolve(LoadLog* load_log,
+ const HostResolver::RequestInfo& info,
AddressList* addresses,
CompletionCallback* callback) {
DCHECK(!cur_request_ && !cur_request_callback_) << "resolver already in use";
@@ -36,7 +37,8 @@ int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info,
// we can clear out |cur_request_*|.
CompletionCallback* transient_callback = callback ? &callback_ : NULL;
- int rv = resolver_->Resolve(info, addresses, transient_callback, &request);
+ int rv = resolver_->Resolve(
+ load_log, info, addresses, transient_callback, &request);
if (rv == ERR_IO_PENDING) {
// Cleared in OnResolveCompletion().
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index 7bdd70e..b6b4180 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -16,6 +16,7 @@ class MessageLoop;
namespace net {
class AddressList;
+class LoadLog;
// This class represents the task of resolving hostnames (or IP address
// literal) to an AddressList object.
@@ -111,8 +112,13 @@ class HostResolver : public base::RefCounted<HostResolver> {
// result code will be passed to the completion callback. If |req| is
// non-NULL, then |*req| will be filled with a handle to the async request.
// This handle is not valid after the request has completed.
- virtual int Resolve(const RequestInfo& info, AddressList* addresses,
- CompletionCallback* callback, RequestHandle* out_req) = 0;
+ //
+ // Profiling information for the request is saved to |load_log| if non-NULL.
+ virtual int Resolve(LoadLog* load_log,
+ const RequestInfo& info,
+ AddressList* addresses,
+ CompletionCallback* callback,
+ RequestHandle* out_req) = 0;
// Cancels the specified request. |req| is the handle returned by Resolve().
// After a request is cancelled, its completion callback will not be called.
@@ -146,8 +152,10 @@ class SingleRequestHostResolver {
// Resolves the given hostname (or IP address literal), filling out the
// |addresses| object upon success. See HostResolver::Resolve() for details.
- int Resolve(const HostResolver::RequestInfo& info,
- AddressList* addresses, CompletionCallback* callback);
+ int Resolve(LoadLog* load_log,
+ const HostResolver::RequestInfo& info,
+ AddressList* addresses,
+ CompletionCallback* callback);
private:
// Callback for when the request to |resolver_| completes, so we dispatch
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 702f2f0..111e8da 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -289,7 +289,8 @@ HostResolverImpl::~HostResolverImpl() {
// TODO(eroman): Don't create cache entries for hostnames which are simply IP
// address literals.
-int HostResolverImpl::Resolve(const RequestInfo& info,
+int HostResolverImpl::Resolve(LoadLog* load_log,
+ const RequestInfo& info,
AddressList* addresses,
CompletionCallback* callback,
RequestHandle* out_req) {
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 6ece456..ff9e4e7 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -57,8 +57,11 @@ class HostResolverImpl : public HostResolver {
virtual ~HostResolverImpl();
// HostResolver methods:
- virtual int Resolve(const RequestInfo& info, AddressList* addresses,
- CompletionCallback* callback, RequestHandle* out_req);
+ virtual int Resolve(LoadLog* load_log,
+ const RequestInfo& info,
+ AddressList* addresses,
+ CompletionCallback* callback,
+ RequestHandle* out_req);
virtual void CancelRequest(RequestHandle req);
virtual void AddObserver(Observer* observer);
virtual void RemoveObserver(Observer* observer);
diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc
index 350a25d..e33bbf4e 100644
--- a/net/base/host_resolver_impl_unittest.cc
+++ b/net/base/host_resolver_impl_unittest.cc
@@ -91,7 +91,7 @@ class ResolveRequest {
ALLOW_THIS_IN_INITIALIZER_LIST(
callback_(this, &ResolveRequest::OnLookupFinished)) {
// Start the request.
- int err = resolver->Resolve(info_, &addrlist_, &callback_, &req_);
+ int err = resolver->Resolve(NULL, info_, &addrlist_, &callback_, &req_);
EXPECT_EQ(net::ERR_IO_PENDING, err);
}
@@ -102,7 +102,7 @@ class ResolveRequest {
ALLOW_THIS_IN_INITIALIZER_LIST(
callback_(this, &ResolveRequest::OnLookupFinished)) {
// Start the request.
- int err = resolver->Resolve(info, &addrlist_, &callback_, &req_);
+ int err = resolver->Resolve(NULL, info, &addrlist_, &callback_, &req_);
EXPECT_EQ(net::ERR_IO_PENDING, err);
}
@@ -187,7 +187,7 @@ TEST_F(HostResolverImplTest, SynchronousLookup) {
new HostResolverImpl(resolver_proc, kMaxCacheEntries, kMaxCacheAgeMs));
net::HostResolver::RequestInfo info("just.testing", kPortnum);
- int err = host_resolver->Resolve(info, &adrlist, NULL, NULL);
+ int err = host_resolver->Resolve(NULL, info, &adrlist, NULL, NULL);
EXPECT_EQ(net::OK, err);
const struct addrinfo* ainfo = adrlist.head();
@@ -212,7 +212,7 @@ TEST_F(HostResolverImplTest, AsynchronousLookup) {
new HostResolverImpl(resolver_proc, kMaxCacheEntries, kMaxCacheAgeMs));
net::HostResolver::RequestInfo info("just.testing", kPortnum);
- int err = host_resolver->Resolve(info, &adrlist, &callback_, NULL);
+ int err = host_resolver->Resolve(NULL, info, &adrlist, &callback_, NULL);
EXPECT_EQ(net::ERR_IO_PENDING, err);
MessageLoop::current()->Run();
@@ -241,7 +241,7 @@ TEST_F(HostResolverImplTest, CanceledAsynchronousLookup) {
const int kPortnum = 80;
net::HostResolver::RequestInfo info("just.testing", kPortnum);
- int err = host_resolver->Resolve(info, &adrlist, &callback_, NULL);
+ int err = host_resolver->Resolve(NULL, info, &adrlist, &callback_, NULL);
EXPECT_EQ(net::ERR_IO_PENDING, err);
// Make sure we will exit the queue even when callback is not called.
@@ -268,7 +268,7 @@ TEST_F(HostResolverImplTest, NumericIPv4Address) {
net::AddressList adrlist;
const int kPortnum = 5555;
net::HostResolver::RequestInfo info("127.1.2.3", kPortnum);
- int err = host_resolver->Resolve(info, &adrlist, NULL, NULL);
+ int err = host_resolver->Resolve(NULL, info, &adrlist, NULL, NULL);
EXPECT_EQ(net::OK, err);
const struct addrinfo* ainfo = adrlist.head();
@@ -293,7 +293,7 @@ TEST_F(HostResolverImplTest, NumericIPv6Address) {
net::AddressList adrlist;
const int kPortnum = 5555;
net::HostResolver::RequestInfo info("2001:db8::1", kPortnum);
- int err = host_resolver->Resolve(info, &adrlist, NULL, NULL);
+ int err = host_resolver->Resolve(NULL, info, &adrlist, NULL, NULL);
// On computers without IPv6 support, getaddrinfo cannot convert IPv6
// address literals to addresses (getaddrinfo returns EAI_NONAME). So this
// test has to allow host_resolver->Resolve to fail.
@@ -333,7 +333,7 @@ TEST_F(HostResolverImplTest, DISABLED_EmptyHost) {
net::AddressList adrlist;
const int kPortnum = 5555;
net::HostResolver::RequestInfo info("", kPortnum);
- int err = host_resolver->Resolve(info, &adrlist, NULL, NULL);
+ int err = host_resolver->Resolve(NULL, info, &adrlist, NULL, NULL);
EXPECT_EQ(net::ERR_NAME_NOT_RESOLVED, err);
}
@@ -684,7 +684,7 @@ class BypassCacheVerifier : public ResolveRequest::Delegate {
net::AddressList addrlist;
net::HostResolver::RequestInfo info("a", 70);
- int error = resolver->Resolve(info, &addrlist, junk_callback, NULL);
+ int error = resolver->Resolve(NULL, info, &addrlist, junk_callback, NULL);
EXPECT_EQ(net::OK, error);
// Ok good. Now make sure that if we ask to bypass the cache, it can no
@@ -801,7 +801,7 @@ TEST_F(HostResolverImplTest, Observers) {
// Resolve "host1".
net::HostResolver::RequestInfo info1("host1", 70);
- int rv = host_resolver->Resolve(info1, &addrlist, NULL, NULL);
+ int rv = host_resolver->Resolve(NULL, info1, &addrlist, NULL, NULL);
EXPECT_EQ(net::OK, rv);
EXPECT_EQ(1U, observer.start_log.size());
@@ -815,7 +815,7 @@ TEST_F(HostResolverImplTest, Observers) {
// Resolve "host1" again -- this time it will be served from cache, but it
// should still notify of completion.
TestCompletionCallback callback;
- rv = host_resolver->Resolve(info1, &addrlist, &callback, NULL);
+ rv = host_resolver->Resolve(NULL, info1, &addrlist, &callback, NULL);
ASSERT_EQ(net::OK, rv); // Should complete synchronously.
EXPECT_EQ(2U, observer.start_log.size());
@@ -829,7 +829,7 @@ TEST_F(HostResolverImplTest, Observers) {
// Resolve "host2", setting referrer to "http://foobar.com"
net::HostResolver::RequestInfo info2("host2", 70);
info2.set_referrer(GURL("http://foobar.com"));
- rv = host_resolver->Resolve(info2, &addrlist, NULL, NULL);
+ rv = host_resolver->Resolve(NULL, info2, &addrlist, NULL, NULL);
EXPECT_EQ(net::OK, rv);
EXPECT_EQ(3U, observer.start_log.size());
@@ -845,7 +845,7 @@ TEST_F(HostResolverImplTest, Observers) {
// Resolve "host3"
net::HostResolver::RequestInfo info3("host3", 70);
- host_resolver->Resolve(info3, &addrlist, NULL, NULL);
+ host_resolver->Resolve(NULL, info3, &addrlist, NULL, NULL);
// No effect this time, since observer was removed.
EXPECT_EQ(3U, observer.start_log.size());
@@ -875,7 +875,7 @@ TEST_F(HostResolverImplTest, CancellationObserver) {
net::HostResolver::RequestInfo info1("host1", 70);
net::HostResolver::RequestHandle req = NULL;
net::AddressList addrlist;
- int rv = host_resolver->Resolve(info1, &addrlist, &callback, &req);
+ int rv = host_resolver->Resolve(NULL, info1, &addrlist, &callback, &req);
EXPECT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_TRUE(NULL != req);
@@ -898,7 +898,7 @@ TEST_F(HostResolverImplTest, CancellationObserver) {
// Start an async request for (host2:60)
net::HostResolver::RequestInfo info2("host2", 60);
- rv = host_resolver->Resolve(info2, &addrlist, &callback, NULL);
+ rv = host_resolver->Resolve(NULL, info2, &addrlist, &callback, NULL);
EXPECT_EQ(net::ERR_IO_PENDING, rv);
EXPECT_TRUE(NULL != req);
diff --git a/net/base/load_log.h b/net/base/load_log.h
new file mode 100644
index 0000000..0efe242
--- /dev/null
+++ b/net/base/load_log.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_BASE_LOAD_LOG_H_
+#define NET_BASE_LOAD_LOG_H_
+
+#include "base/ref_counted.h"
+
+namespace net {
+
+// LoadLog stores profiling information on where time was spent while servicing
+// a request (waiting in queues, resolving hosts, resolving proxy, etc...).
+class LoadLog : public base::RefCounted<LoadLog> {
+ public:
+// TODO(eroman): Add an API similar to:
+// void TrackEnterState(LoadState state);
+// void TrackLeaveState(LoadState state);
+// void Merge(const LoadLog* other);
+};
+
+} // namespace net
+
+#endif // NET_BASE_LOAD_LOG_H_
diff --git a/net/base/mock_host_resolver.cc b/net/base/mock_host_resolver.cc
index c83f3c8..32a66d1 100644
--- a/net/base/mock_host_resolver.cc
+++ b/net/base/mock_host_resolver.cc
@@ -42,7 +42,8 @@ MockHostResolverBase::MockHostResolverBase(bool use_caching)
Reset(NULL);
}
-int MockHostResolverBase::Resolve(const RequestInfo& info,
+int MockHostResolverBase::Resolve(LoadLog* load_log,
+ const RequestInfo& info,
AddressList* addresses,
CompletionCallback* callback,
RequestHandle* out_req) {
@@ -50,7 +51,7 @@ int MockHostResolverBase::Resolve(const RequestInfo& info,
callback = NULL;
out_req = NULL;
}
- return impl_->Resolve(info, addresses, callback, out_req);
+ return impl_->Resolve(load_log, info, addresses, callback, out_req);
}
void MockHostResolverBase::CancelRequest(RequestHandle req) {
diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h
index d3d3f44..2dd97b9 100644
--- a/net/base/mock_host_resolver.h
+++ b/net/base/mock_host_resolver.h
@@ -41,8 +41,11 @@ class MockHostResolverBase : public HostResolver {
virtual ~MockHostResolverBase() {}
// HostResolver methods:
- virtual int Resolve(const RequestInfo& info, AddressList* addresses,
- CompletionCallback* callback, RequestHandle* out_req);
+ virtual int Resolve(LoadLog* load_log,
+ const RequestInfo& info,
+ AddressList* addresses,
+ CompletionCallback* callback,
+ RequestHandle* out_req);
virtual void CancelRequest(RequestHandle req);
virtual void AddObserver(Observer* observer);
virtual void RemoveObserver(Observer* observer);
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index c009a62..a90ea50 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/string_util.h"
#include "net/base/connection_type_histograms.h"
+#include "net/base/load_log.h"
#include "net/base/net_errors.h"
#include "net/ftp/ftp_network_session.h"
#include "net/ftp/ftp_request_info.h"
@@ -49,8 +50,10 @@ FtpNetworkTransaction::FtpNetworkTransaction(
FtpNetworkTransaction::~FtpNetworkTransaction() {
}
-int FtpNetworkTransaction::Start(const FtpRequestInfo* request_info,
+int FtpNetworkTransaction::Start(LoadLog* load_log,
+ const FtpRequestInfo* request_info,
CompletionCallback* callback) {
+ load_log_ = load_log;
request_ = request_info;
next_state_ = STATE_CTRL_INIT;
@@ -390,7 +393,7 @@ int FtpNetworkTransaction::DoCtrlResolveHost() {
HostResolver::RequestInfo info(host, port);
// No known referrer.
- return resolver_.Resolve(info, &addresses_, &io_callback_);
+ return resolver_.Resolve(load_log_, info, &addresses_, &io_callback_);
}
int FtpNetworkTransaction::DoCtrlResolveHostComplete(int result) {
@@ -915,7 +918,7 @@ int FtpNetworkTransaction::DoDataResolveHost() {
HostResolver::RequestInfo info(data_connection_ip_,
data_connection_port_);
// No known referrer.
- return resolver_.Resolve(info, &addresses_, &io_callback_);
+ return resolver_.Resolve(load_log_, info, &addresses_, &io_callback_);
}
int FtpNetworkTransaction::DoDataResolveHostComplete(int result) {
diff --git a/net/ftp/ftp_network_transaction.h b/net/ftp/ftp_network_transaction.h
index f138f42..1a9c521f 100644
--- a/net/ftp/ftp_network_transaction.h
+++ b/net/ftp/ftp_network_transaction.h
@@ -31,7 +31,8 @@ class FtpNetworkTransaction : public FtpTransaction {
virtual ~FtpNetworkTransaction();
// FtpTransaction methods:
- virtual int Start(const FtpRequestInfo* request_info,
+ virtual int Start(LoadLog* load_log,
+ const FtpRequestInfo* request_info,
CompletionCallback* callback);
virtual int Stop(int error);
virtual int RestartWithAuth(const std::wstring& username,
@@ -155,6 +156,7 @@ class FtpNetworkTransaction : public FtpTransaction {
scoped_refptr<FtpNetworkSession> session_;
+ scoped_refptr<LoadLog> load_log_;
const FtpRequestInfo* request_;
FtpResponseInfo response_;
diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc
index 5a981af..10c77a3 100644
--- a/net/ftp/ftp_network_transaction_unittest.cc
+++ b/net/ftp/ftp_network_transaction_unittest.cc
@@ -309,7 +309,8 @@ class FtpNetworkTransactionTest : public PlatformTest {
mock_socket_factory_.AddMockSocket(&data_socket1);
mock_socket_factory_.AddMockSocket(&data_socket2);
FtpRequestInfo request_info = GetRequestInfo(request);
- ASSERT_EQ(ERR_IO_PENDING, transaction_.Start(&request_info, &callback_));
+ ASSERT_EQ(ERR_IO_PENDING,
+ transaction_.Start(NULL, &request_info, &callback_));
EXPECT_EQ(expected_result, callback_.WaitForResult());
EXPECT_EQ(FtpMockControlSocket::QUIT, ctrl_socket->state());
if (expected_result == OK) {
@@ -343,7 +344,8 @@ class FtpNetworkTransactionTest : public PlatformTest {
TEST_F(FtpNetworkTransactionTest, FailedLookup) {
FtpRequestInfo request_info = GetRequestInfo("ftp://badhost");
host_resolver_->rules()->AddSimulatedFailure("badhost");
- ASSERT_EQ(ERR_IO_PENDING, transaction_.Start(&request_info, &callback_));
+ ASSERT_EQ(ERR_IO_PENDING,
+ transaction_.Start(NULL, &request_info, &callback_));
EXPECT_EQ(ERR_NAME_NOT_RESOLVED, callback_.WaitForResult());
}
diff --git a/net/ftp/ftp_transaction.h b/net/ftp/ftp_transaction.h
index a0798ea..d0620f6 100644
--- a/net/ftp/ftp_transaction.h
+++ b/net/ftp/ftp_transaction.h
@@ -13,6 +13,7 @@ namespace net {
class FtpRequestInfo;
class FtpResponseInfo;
+class LoadLog;
// Represents a single FTP transaction.
class FtpTransaction {
@@ -34,7 +35,9 @@ class FtpTransaction {
//
// NOTE: The transaction is not responsible for deleting the callback object.
//
- virtual int Start(const FtpRequestInfo* request_info,
+ // Profiling information for the request is saved to |load_log| if non-NULL.
+ virtual int Start(LoadLog* load_log,
+ const FtpRequestInfo* request_info,
CompletionCallback* callback) = 0;
// Restarts the FTP transaction with authentication credentials.
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index b7707d1..5265ca7 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -194,7 +194,7 @@ class HttpCache::Transaction
virtual ~Transaction();
// HttpTransaction methods:
- virtual int Start(const HttpRequestInfo*, CompletionCallback*);
+ virtual int Start(LoadLog*, const HttpRequestInfo*, CompletionCallback*);
virtual int RestartIgnoringLastError(CompletionCallback*);
virtual int RestartWithCertificate(X509Certificate* client_cert,
CompletionCallback* callback);
@@ -256,7 +256,7 @@ class HttpCache::Transaction
int HandleResult(int rv);
// Sets request_ and fields derived from it.
- void SetRequest(const HttpRequestInfo* request);
+ void SetRequest(LoadLog* load_log, const HttpRequestInfo* request);
// Returns true if the request should be handled exclusively by the network
// layer (skipping the cache entirely).
@@ -365,6 +365,7 @@ class HttpCache::Transaction
// Called to signal completion of the cache's ReadData method:
void OnCacheReadCompleted(int result);
+ scoped_refptr<LoadLog> load_log_;
const HttpRequestInfo* request_;
scoped_ptr<HttpRequestInfo> custom_request_;
// If extra_headers specified a "if-modified-since" or "if-none-match",
@@ -409,7 +410,8 @@ HttpCache::Transaction::~Transaction() {
cache_ = NULL;
}
-int HttpCache::Transaction::Start(const HttpRequestInfo* request,
+int HttpCache::Transaction::Start(LoadLog* load_log,
+ const HttpRequestInfo* request,
CompletionCallback* callback) {
DCHECK(request);
DCHECK(callback);
@@ -420,7 +422,7 @@ int HttpCache::Transaction::Start(const HttpRequestInfo* request,
if (revoked())
return ERR_UNEXPECTED;
- SetRequest(request);
+ SetRequest(load_log, request);
int rv;
@@ -709,7 +711,9 @@ int HttpCache::Transaction::HandleResult(int rv) {
return rv;
}
-void HttpCache::Transaction::SetRequest(const HttpRequestInfo* request) {
+void HttpCache::Transaction::SetRequest(LoadLog* load_log,
+ const HttpRequestInfo* request) {
+ load_log_ = load_log;
request_ = request;
effective_load_flags_ = request_->load_flags;
@@ -978,7 +982,7 @@ int HttpCache::Transaction::BeginNetworkRequest() {
if (!network_trans_.get())
return net::ERR_CACHE_CANNOT_CREATE_NETWORK_TRANSACTION;
- int rv = network_trans_->Start(request_, &network_info_callback_);
+ int rv = network_trans_->Start(load_log_, request_, &network_info_callback_);
if (rv != ERR_IO_PENDING)
OnNetworkInfoAvailable(rv);
return rv;
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 2efd751..a7b93e0 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -394,7 +394,7 @@ void RunTransactionTestWithRequest(net::HttpCache* cache,
scoped_ptr<net::HttpTransaction> trans(cache->CreateTransaction());
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::OK, rv);
@@ -680,7 +680,7 @@ TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Miss) {
cache.http_cache()->CreateTransaction());
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::ERR_CACHE_MISS, rv);
@@ -837,7 +837,7 @@ TEST(HttpCache, SimpleGET_ManyReaders) {
new Context(cache.http_cache()->CreateTransaction()));
Context* c = context_list[i];
- int rv = c->trans->Start(&request, &c->callback);
+ int rv = c->trans->Start(NULL, &request, &c->callback);
if (rv != net::ERR_IO_PENDING)
c->result = rv;
}
@@ -891,7 +891,7 @@ TEST(HttpCache, SimpleGET_RacingReaders) {
if (i == 1 || i == 2)
this_request = &reader_request;
- int rv = c->trans->Start(this_request, &c->callback);
+ int rv = c->trans->Start(NULL, this_request, &c->callback);
if (rv != net::ERR_IO_PENDING)
c->result = rv;
}
@@ -963,7 +963,7 @@ TEST(HttpCache, FastNoStoreGET_DoneWithPending) {
new Context(cache.http_cache()->CreateTransaction()));
Context* c = context_list[i];
- int rv = c->trans->Start(&request, &c->callback);
+ int rv = c->trans->Start(NULL, &request, &c->callback);
if (rv != net::ERR_IO_PENDING)
c->result = rv;
}
@@ -1006,7 +1006,7 @@ TEST(HttpCache, SimpleGET_ManyWriters_CancelFirst) {
new Context(cache.http_cache()->CreateTransaction()));
Context* c = context_list[i];
- int rv = c->trans->Start(&request, &c->callback);
+ int rv = c->trans->Start(NULL, &request, &c->callback);
if (rv != net::ERR_IO_PENDING)
c->result = rv;
}
@@ -1058,7 +1058,7 @@ TEST(HttpCache, SimpleGET_AbandonedCacheRead) {
scoped_ptr<net::HttpTransaction> trans(
cache.http_cache()->CreateTransaction());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::OK, rv);
@@ -1573,7 +1573,7 @@ TEST(HttpCache, SimplePOST_LoadOnlyFromCache_Miss) {
cache.http_cache()->CreateTransaction());
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::ERR_CACHE_MISS, rv);
@@ -1977,13 +1977,13 @@ TEST(HttpCache, SyncRead) {
c2(cache.http_cache()),
c3(cache.http_cache());
- c1.Start(&r1);
+ c1.Start(NULL, &r1);
r2.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- c2.Start(&r2);
+ c2.Start(NULL, &r2);
r3.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- c3.Start(&r3);
+ c3.Start(NULL, &r3);
MessageLoop::current()->Run();
@@ -2030,7 +2030,7 @@ TEST(HttpCache, CachedRedirect) {
cache.http_cache()->CreateTransaction());
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::OK, rv);
@@ -2057,7 +2057,7 @@ TEST(HttpCache, CachedRedirect) {
cache.http_cache()->CreateTransaction());
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::OK, rv);
@@ -2184,7 +2184,7 @@ TEST(HttpCache, SimpleGET_SSLError) {
cache.http_cache()->CreateTransaction());
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::ERR_CACHE_MISS, rv);
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc
index b61ca3d..064a8e4 100644
--- a/net/http/http_network_layer_unittest.cc
+++ b/net/http/http_network_layer_unittest.cc
@@ -69,7 +69,7 @@ TEST_F(HttpNetworkLayerTest, GET) {
request_info.user_agent = "Foo/1.0";
request_info.load_flags = net::LOAD_NORMAL;
- int rv = trans->Start(&request_info, &callback);
+ int rv = trans->Start(NULL, &request_info, &callback);
if (rv == net::ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(net::OK, rv);
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index f4894de..1a1b2f0 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -161,10 +161,12 @@ HttpNetworkTransaction::HttpNetworkTransaction(HttpNetworkSession* session,
#endif
}
-int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info,
+int HttpNetworkTransaction::Start(LoadLog* load_log,
+ const HttpRequestInfo* request_info,
CompletionCallback* callback) {
UpdateConnectionTypeHistograms(CONNECTION_ANY);
+ load_log_ = load_log;
request_ = request_info;
start_time_ = base::Time::Now();
@@ -540,7 +542,7 @@ int HttpNetworkTransaction::DoResolveProxy() {
}
return session_->proxy_service()->ResolveProxy(
- request_->url, &proxy_info_, &io_callback_, &pac_request_);
+ load_log_, request_->url, &proxy_info_, &io_callback_, &pac_request_);
}
int HttpNetworkTransaction::DoResolveProxyComplete(int result) {
@@ -627,8 +629,8 @@ int HttpNetworkTransaction::DoInitConnection() {
transport_socket_request_time_ = base::TimeTicks::Now();
- int rv = connection_.Init(connection_group, resolve_info, request_->priority,
- &io_callback_);
+ int rv = connection_.Init(NULL, connection_group, resolve_info,
+ request_->priority, &io_callback_);
return rv;
}
@@ -1544,7 +1546,7 @@ int HttpNetworkTransaction::ReconsiderProxyAfterError(int error) {
}
int rv = session_->proxy_service()->ReconsiderProxyAfterError(
- request_->url, &proxy_info_, &io_callback_, &pac_request_);
+ load_log_, request_->url, &proxy_info_, &io_callback_, &pac_request_);
if (rv == OK || rv == ERR_IO_PENDING) {
// If the error was during connection setup, there is no socket to
// disconnect.
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 83524c4..301aa92 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -41,7 +41,8 @@ class HttpNetworkTransaction : public HttpTransaction {
virtual ~HttpNetworkTransaction();
// HttpTransaction methods:
- virtual int Start(const HttpRequestInfo* request_info,
+ virtual int Start(LoadLog* load_log,
+ const HttpRequestInfo* request_info,
CompletionCallback* callback);
virtual int RestartIgnoringLastError(CompletionCallback* callback);
virtual int RestartWithCertificate(X509Certificate* client_cert,
@@ -302,6 +303,7 @@ class HttpNetworkTransaction : public HttpTransaction {
scoped_refptr<HttpNetworkSession> session_;
+ scoped_refptr<LoadLog> load_log_;
const HttpRequestInfo* request_;
HttpResponseInfo response_;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 44a06e7..05bb734 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -96,7 +96,7 @@ class HttpNetworkTransactionTest : public PlatformTest {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
out.rv = callback.WaitForResult();
@@ -169,7 +169,8 @@ class CaptureGroupNameSocketPool : public ClientSocketPool {
public:
CaptureGroupNameSocketPool() {
}
- 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,
@@ -351,7 +352,7 @@ TEST_F(HttpNetworkTransactionTest, Head) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -409,7 +410,7 @@ TEST_F(HttpNetworkTransactionTest, ReuseConnection) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -453,7 +454,7 @@ TEST_F(HttpNetworkTransactionTest, Ignores100) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -497,7 +498,7 @@ TEST_F(HttpNetworkTransactionTest, Ignores1xx) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -553,7 +554,7 @@ void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest(
scoped_ptr<HttpTransaction> trans(
new HttpNetworkTransaction(session, &session_deps.socket_factory));
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -605,7 +606,7 @@ TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -692,7 +693,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuth) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -768,7 +769,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAlive) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -847,7 +848,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -929,7 +930,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -1010,7 +1011,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyKeepAlive) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -1092,7 +1093,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -1145,7 +1146,7 @@ void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus(
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -1405,7 +1406,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyThenServer) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -1540,7 +1541,7 @@ TEST_F(HttpNetworkTransactionTest, NTLMAuth1) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -1714,7 +1715,7 @@ TEST_F(HttpNetworkTransactionTest, NTLMAuth2) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -1809,7 +1810,7 @@ TEST_F(HttpNetworkTransactionTest, LargeHeadersNoBody) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -1857,7 +1858,7 @@ TEST_F(HttpNetworkTransactionTest, DontRecycleTCPSocketForSSLTunnel) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -1907,7 +1908,7 @@ TEST_F(HttpNetworkTransactionTest, RecycleSocket) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -1965,7 +1966,7 @@ TEST_F(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2059,7 +2060,7 @@ TEST_F(HttpNetworkTransactionTest, ResendRequestOnWriteBodyError) {
TestCompletionCallback callback;
- int rv = trans->Start(&request[i], &callback);
+ int rv = trans->Start(NULL, &request[i], &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2129,7 +2130,7 @@ TEST_F(HttpNetworkTransactionTest, AuthIdentityInUrl) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -2205,7 +2206,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -2289,7 +2290,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -2354,7 +2355,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -2415,7 +2416,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -2502,7 +2503,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
TestCompletionCallback callback1;
- int rv = trans->Start(&request, &callback1);
+ int rv = trans->Start(NULL, &request, &callback1);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback1.WaitForResult();
@@ -2639,7 +2640,7 @@ TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificate) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2715,7 +2716,7 @@ TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {
CreateSession(&session_deps),
&session_deps.socket_factory));
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2766,7 +2767,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_UserAgent) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2806,7 +2807,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_Referer) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2844,7 +2845,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2882,7 +2883,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2920,7 +2921,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -2960,7 +2961,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3000,7 +3001,7 @@ TEST_F(HttpNetworkTransactionTest,
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3039,7 +3040,7 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3084,7 +3085,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3142,7 +3143,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS4_SSL_GET) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3201,7 +3202,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3264,7 +3265,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS5_SSL_GET) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3344,7 +3345,7 @@ TEST_F(HttpNetworkTransactionTest, GroupNameForProxyConnections) {
TestCompletionCallback callback;
// We do not complete this request, the dtor will clean the transaction up.
- EXPECT_EQ(ERR_IO_PENDING, trans->Start(&request, &callback));
+ EXPECT_EQ(ERR_IO_PENDING, trans->Start(NULL, &request, &callback));
EXPECT_EQ(tests[i].expected_group_name,
conn_pool->last_group_name_received());
}
@@ -3367,7 +3368,7 @@ TEST_F(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) {
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
@@ -3443,7 +3444,7 @@ TEST_F(HttpNetworkTransactionTest, ResolveMadeWithReferrer) {
// Run the request until it fails reading from the socket.
TestCompletionCallback callback;
- int rv = trans->Start(&request, &callback);
+ int rv = trans->Start(NULL, &request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
EXPECT_EQ(ERR_FAILED, rv);
@@ -3467,13 +3468,14 @@ TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) {
// a synchronous lookup.)
AddressList addrlist;
int rv = session_deps.host_resolver->Resolve(
- HostResolver::RequestInfo("www.google.com", 80), &addrlist, NULL, NULL);
+ NULL, HostResolver::RequestInfo("www.google.com", 80), &addrlist,
+ NULL, NULL);
EXPECT_EQ(OK, rv);
// Verify that it was added to host cache, by doing a subsequent async lookup
// and confirming it completes synchronously.
TestCompletionCallback resolve_callback;
- rv = session_deps.host_resolver->Resolve(
+ rv = session_deps.host_resolver->Resolve(NULL,
HostResolver::RequestInfo("www.google.com", 80), &addrlist,
&resolve_callback, NULL);
ASSERT_EQ(OK, rv);
@@ -3497,7 +3499,7 @@ TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh) {
// Run the request.
TestCompletionCallback callback;
- rv = trans->Start(&request, &callback);
+ rv = trans->Start(NULL, &request, &callback);
ASSERT_EQ(ERR_IO_PENDING, rv);
rv = callback.WaitForResult();
diff --git a/net/http/http_transaction.h b/net/http/http_transaction.h
index 14612e9..962a7ac 100644
--- a/net/http/http_transaction.h
+++ b/net/http/http_transaction.h
@@ -13,6 +13,7 @@ namespace net {
class HttpRequestInfo;
class HttpResponseInfo;
class IOBuffer;
+class LoadLog;
class X509Certificate;
// Represents a single HTTP transaction (i.e., a single request/response pair).
@@ -36,7 +37,9 @@ class HttpTransaction {
//
// NOTE: The transaction is not responsible for deleting the callback object.
//
- virtual int Start(const HttpRequestInfo* request_info,
+ // Profiling information for the request is saved to |load_log| if non-NULL.
+ virtual int Start(LoadLog* load_log,
+ const HttpRequestInfo* request_info,
CompletionCallback* callback) = 0;
// Restarts the HTTP transaction, ignoring the last error. This call can
diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h
index f72c305..7aee84f 100644
--- a/net/http/http_transaction_unittest.h
+++ b/net/http/http_transaction_unittest.h
@@ -108,9 +108,9 @@ class TestTransactionConsumer : public CallbackRunner< Tuple1<int> > {
~TestTransactionConsumer() {
}
- void Start(const net::HttpRequestInfo* request) {
+ void Start(net::LoadLog* load_log, const net::HttpRequestInfo* request) {
state_ = STARTING;
- int result = trans_->Start(request, this);
+ int result = trans_->Start(load_log, request, this);
if (result != net::ERR_IO_PENDING)
DidStart(result);
}
@@ -199,7 +199,8 @@ class MockNetworkTransaction : public net::HttpTransaction {
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), data_cursor_(0) {
}
- virtual int Start(const net::HttpRequestInfo* request,
+ virtual int Start(net::LoadLog* load_log,
+ const net::HttpRequestInfo* request,
net::CompletionCallback* callback) {
const MockTransaction* t = FindMockTransaction(request->url);
if (!t)
diff --git a/net/net.gyp b/net/net.gyp
index 4577126..32788d7 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -82,6 +82,7 @@
'base/listen_socket.cc',
'base/listen_socket.h',
'base/load_flags.h',
+ 'base/load_log.h',
'base/load_states.h',
'base/mime_sniffer.cc',
'base/mime_sniffer.h',
diff --git a/net/proxy/proxy_resolver_js_bindings.cc b/net/proxy/proxy_resolver_js_bindings.cc
index 6787b1b..723c91e 100644
--- a/net/proxy/proxy_resolver_js_bindings.cc
+++ b/net/proxy/proxy_resolver_js_bindings.cc
@@ -38,7 +38,7 @@ class SyncHostResolverBridge
// Hack for tests -- run synchronously on current thread.
if (!host_resolver_loop_)
- return host_resolver_->Resolve(info, addresses, NULL, NULL);
+ return host_resolver_->Resolve(NULL, info, addresses, NULL, NULL);
// Otherwise start an async resolve on the resolver's thread.
host_resolver_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
@@ -54,7 +54,8 @@ class SyncHostResolverBridge
void StartResolve(const HostResolver::RequestInfo& info,
net::AddressList* addresses) {
DCHECK_EQ(host_resolver_loop_, MessageLoop::current());
- int error = host_resolver_->Resolve(info, addresses, &callback_, NULL);
+ int error = host_resolver_->Resolve(
+ NULL, info, addresses, &callback_, NULL);
if (error != ERR_IO_PENDING)
OnResolveCompletion(error); // Completed synchronously.
}
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 1798421..43b7cfe 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -246,7 +246,9 @@ ProxyService* ProxyService::CreateNull() {
return new ProxyService(new ProxyConfigServiceNull, new ProxyResolverNull);
}
-int ProxyService::ResolveProxy(const GURL& raw_url, ProxyInfo* result,
+int ProxyService::ResolveProxy(LoadLog* load_log,
+ const GURL& raw_url,
+ ProxyInfo* result,
CompletionCallback* callback,
PacRequest** pac_request) {
DCHECK(callback);
@@ -403,7 +405,8 @@ void ProxyService::OnInitProxyResolverComplete(int result) {
ResumeAllPendingRequests();
}
-int ProxyService::ReconsiderProxyAfterError(const GURL& url,
+int ProxyService::ReconsiderProxyAfterError(LoadLog* load_log,
+ const GURL& url,
ProxyInfo* result,
CompletionCallback* callback,
PacRequest** pac_request) {
@@ -429,7 +432,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url,
// If we have a new config or the config was never tried, we delete the
// list of bad proxies and we try again.
proxy_retry_info_.clear();
- return ResolveProxy(url, result, callback, pac_request);
+ return ResolveProxy(load_log, url, result, callback, pac_request);
}
// We don't have new proxy settings to try, fallback to the next proxy
@@ -699,12 +702,13 @@ SyncProxyServiceHelper::SyncProxyServiceHelper(MessageLoop* io_message_loop,
DCHECK(io_message_loop_ != MessageLoop::current());
}
-int SyncProxyServiceHelper::ResolveProxy(const GURL& url,
+int SyncProxyServiceHelper::ResolveProxy(LoadLog* load_log,
+ const GURL& url,
ProxyInfo* proxy_info) {
DCHECK(io_message_loop_ != MessageLoop::current());
io_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &SyncProxyServiceHelper::StartAsyncResolve, url));
+ this, &SyncProxyServiceHelper::StartAsyncResolve, load_log, url));
event_.Wait();
@@ -714,12 +718,12 @@ int SyncProxyServiceHelper::ResolveProxy(const GURL& url,
return result_;
}
-int SyncProxyServiceHelper::ReconsiderProxyAfterError(const GURL& url,
- ProxyInfo* proxy_info) {
+int SyncProxyServiceHelper::ReconsiderProxyAfterError(
+ LoadLog* load_log, const GURL& url, ProxyInfo* proxy_info) {
DCHECK(io_message_loop_ != MessageLoop::current());
io_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &SyncProxyServiceHelper::StartAsyncReconsider, url));
+ this, &SyncProxyServiceHelper::StartAsyncReconsider, load_log, url));
event_.Wait();
@@ -729,16 +733,19 @@ int SyncProxyServiceHelper::ReconsiderProxyAfterError(const GURL& url,
return result_;
}
-void SyncProxyServiceHelper::StartAsyncResolve(const GURL& url) {
- result_ = proxy_service_->ResolveProxy(url, &proxy_info_, &callback_, NULL);
+void SyncProxyServiceHelper::StartAsyncResolve(LoadLog* load_log,
+ const GURL& url) {
+ result_ = proxy_service_->ResolveProxy(
+ load_log, url, &proxy_info_, &callback_, NULL);
if (result_ != net::ERR_IO_PENDING) {
OnCompletion(result_);
}
}
-void SyncProxyServiceHelper::StartAsyncReconsider(const GURL& url) {
+void SyncProxyServiceHelper::StartAsyncReconsider(LoadLog* load_log,
+ const GURL& url) {
result_ = proxy_service_->ReconsiderProxyAfterError(
- url, &proxy_info_, &callback_, NULL);
+ load_log, url, &proxy_info_, &callback_, NULL);
if (result_ != net::ERR_IO_PENDING) {
OnCompletion(result_);
}
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index cc678f2..92e68c7 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -25,6 +25,7 @@ class URLRequestContext;
namespace net {
class InitProxyResolver;
+class LoadLog;
class ProxyConfigService;
class ProxyResolver;
class ProxyScriptFetcher;
@@ -63,7 +64,10 @@ class ProxyService {
// 3. WPAD auto-detection
//
// TODO(eroman): see http://crbug.com/9985; the outline above is too simple.
- int ResolveProxy(const GURL& url,
+ //
+ // Profiling information for the request is saved to |load_log| if non-NULL.
+ int ResolveProxy(LoadLog* load_log,
+ const GURL& url,
ProxyInfo* results,
CompletionCallback* callback,
PacRequest** pac_request);
@@ -79,7 +83,9 @@ class ProxyService {
//
// Returns ERR_FAILED if there is not another proxy config to try.
//
- int ReconsiderProxyAfterError(const GURL& url,
+ // Profiling information for the request is saved to |load_log| if non-NULL.
+ int ReconsiderProxyAfterError(LoadLog* load_log,
+ const GURL& url,
ProxyInfo* results,
CompletionCallback* callback,
PacRequest** pac_request);
@@ -262,12 +268,14 @@ class SyncProxyServiceHelper
SyncProxyServiceHelper(MessageLoop* io_message_loop,
ProxyService* proxy_service);
- int ResolveProxy(const GURL& url, ProxyInfo* proxy_info);
- int ReconsiderProxyAfterError(const GURL& url, ProxyInfo* proxy_info);
+ int ResolveProxy(LoadLog* load_log, const GURL& url, ProxyInfo* proxy_info);
+ int ReconsiderProxyAfterError(LoadLog* load_log,
+ const GURL& url,
+ ProxyInfo* proxy_info);
private:
- void StartAsyncResolve(const GURL& url);
- void StartAsyncReconsider(const GURL& url);
+ void StartAsyncResolve(LoadLog* load_log, const GURL& url);
+ void StartAsyncReconsider(LoadLog* load_log, const GURL& url);
void OnCompletion(int result);
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index f4deb67..8a2fb98 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -92,7 +92,7 @@ TEST(ProxyServiceTest, Direct) {
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(resolver->pending_requests().empty());
@@ -111,7 +111,7 @@ TEST(ProxyServiceTest, PAC) {
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -144,7 +144,7 @@ TEST(ProxyServiceTest, PAC_NoIdentityOrHash) {
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -171,7 +171,7 @@ TEST(ProxyServiceTest, PAC_FailoverToDirect) {
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(url, &info, &callback1, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -191,7 +191,7 @@ TEST(ProxyServiceTest, PAC_FailoverToDirect) {
// Now, imagine that connecting to foopy:8080 fails.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -213,7 +213,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) {
GURL url("http://www.google.com/");
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(url, &info, &callback1, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -231,7 +231,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) {
// The second resolve request will automatically select direct connect,
// because it has cached the configuration as being bad.
TestCompletionCallback callback2;
- rv = service.ResolveProxy(url, &info, &callback2, NULL);
+ rv = service.ResolveProxy(NULL, url, &info, &callback2, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
EXPECT_TRUE(resolver->pending_requests().empty());
@@ -239,7 +239,7 @@ TEST(ProxyServiceTest, ProxyResolverFails) {
// But, if that fails, then we should give the proxy config another shot
// since we have never tried it with this URL before.
TestCompletionCallback callback3;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback3, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver->pending_requests().size());
@@ -270,7 +270,7 @@ TEST(ProxyServiceTest, ProxyFallback) {
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(url, &info, &callback1, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -292,14 +292,14 @@ TEST(ProxyServiceTest, ProxyFallback) {
// Fake an error on the proxy.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL);
EXPECT_EQ(OK, rv);
// The second proxy should be specified.
EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI());
TestCompletionCallback callback3;
- rv = service.ResolveProxy(url, &info, &callback3, NULL);
+ rv = service.ResolveProxy(NULL, url, &info, &callback3, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver->pending_requests().size());
@@ -317,19 +317,19 @@ TEST(ProxyServiceTest, ProxyFallback) {
// We fake another error. It should now try the third one.
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback4, NULL);
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI());
// Fake another error, the last proxy is gone, the list should now be empty.
TestCompletionCallback callback5;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback5, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback5, NULL);
EXPECT_EQ(OK, rv); // We try direct.
EXPECT_TRUE(info.is_direct());
// If it fails again, we don't have anything else to try.
TestCompletionCallback callback6;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback6, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback6, NULL);
EXPECT_EQ(ERR_FAILED, rv);
// TODO(nsylvain): Test that the proxy can be retried after the delay.
@@ -350,7 +350,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(url, &info, &callback1, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -375,7 +375,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
config_service->config.pac_url = GURL("http://foopy-new/proxy.pac");
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy-new/proxy.pac"),
@@ -395,7 +395,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
// We fake another error. It should now ignore the first one.
TestCompletionCallback callback3;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback3, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback3, NULL);
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI());
@@ -405,7 +405,7 @@ TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
// We fake another error. It should go back to the first proxy.
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback4, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback4, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy-new2/proxy.pac"),
@@ -438,7 +438,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(url, &info, &callback1, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -458,7 +458,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// Fake a proxy error.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, &info, &callback2, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info, &callback2, NULL);
EXPECT_EQ(OK, rv);
// The first proxy is ignored, and the second one is selected.
@@ -468,7 +468,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// Fake a PAC failure.
ProxyInfo info2;
TestCompletionCallback callback3;
- rv = service.ResolveProxy(url, &info2, &callback3, NULL);
+ rv = service.ResolveProxy(NULL, url, &info2, &callback3, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver->pending_requests().size());
@@ -487,7 +487,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// to check the config since everything works.
ProxyInfo info3;
TestCompletionCallback callback4;
- rv = service.ResolveProxy(url, &info3, &callback4, NULL);
+ rv = service.ResolveProxy(NULL, url, &info3, &callback4, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info3.is_direct());
@@ -495,7 +495,7 @@ TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// resolve the proxy before, and if not (like in this case), we give the
// PAC another try.
TestCompletionCallback callback5;
- rv = service.ReconsiderProxyAfterError(url, &info3, &callback5, NULL);
+ rv = service.ReconsiderProxyAfterError(NULL, url, &info3, &callback5, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver->pending_requests().size());
@@ -526,7 +526,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
GURL url("http://www.google.com/");
// Get the proxy information.
TestCompletionCallback callback;
- int rv = service.ResolveProxy(url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
}
@@ -536,7 +536,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
new MockAsyncProxyResolver());
GURL test_url("http://local");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -549,7 +549,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
new MockAsyncProxyResolver);
GURL test_url("http://www.webkit.org");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -563,7 +563,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
new MockAsyncProxyResolver);
GURL test_url("http://74.125.19.147");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -576,7 +576,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
new MockAsyncProxyResolver);
GURL test_url("http://www.msn.com");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
}
@@ -589,7 +589,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
new MockAsyncProxyResolver);
GURL test_url("http://www.msnbc.msn.com");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -602,7 +602,7 @@ TEST(ProxyServiceTest, ProxyBypassList) {
new MockAsyncProxyResolver);
GURL test_url("HTTP://WWW.MSNBC.MSN.COM");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -624,21 +624,21 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) {
{
GURL test_url("http://www.example.com:99");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
{
GURL test_url("http://www.example.com:100");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
}
{
GURL test_url("http://www.example.com");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
}
@@ -651,7 +651,7 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) {
new MockAsyncProxyResolver);
GURL test_url("http://www.example.com");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -663,7 +663,7 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) {
new MockAsyncProxyResolver);
GURL test_url("http://www.example.com:99");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -677,14 +677,14 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) {
{
GURL test_url("http://[3ffe:2a00:100:7031::1]:99/");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
{
GURL test_url("http://[3ffe:2a00:100:7031::1]/");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
}
@@ -701,14 +701,14 @@ TEST(ProxyServiceTest, ProxyBypassListWithPorts) {
{
GURL test_url("http://[3ffe:2a00:100:7031::1]:99/");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
{
GURL test_url("http://[3ffe:2a00:100:7031::1]/");
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
}
@@ -725,7 +725,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) {
GURL test_url("http://www.msn.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -736,7 +736,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) {
GURL test_url("ftp://ftp.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
EXPECT_EQ("direct://", info.proxy_server().ToURI());
@@ -747,7 +747,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) {
GURL test_url("https://webbranch.techcu.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI());
@@ -759,7 +759,7 @@ TEST(ProxyServiceTest, PerProtocolProxyTests) {
GURL test_url("http://www.microsoft.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -781,7 +781,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) {
GURL test_url("http://www.msn.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -792,7 +792,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) {
GURL test_url("ftp://ftp.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI());
@@ -803,7 +803,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) {
GURL test_url("https://webbranch.techcu.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI());
@@ -814,7 +814,7 @@ TEST(ProxyServiceTest, DefaultProxyFallbackToSOCKS) {
GURL test_url("unknown://www.microsoft.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, &info, &callback, NULL);
+ int rv = service.ResolveProxy(NULL, test_url, &info, &callback, NULL);
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI());
@@ -835,7 +835,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info1, &callback1, NULL);
+ NULL, GURL("http://request1"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Nothing has been sent to the proxy resolver yet, since the proxy
@@ -854,7 +854,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) {
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
rv = service.ResolveProxy(
- GURL("http://request2"), &info2, &callback2, &request2);
+ NULL, GURL("http://request2"), &info2, &callback2, &request2);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(2u, resolver->pending_requests().size());
EXPECT_EQ(GURL("http://request2"), resolver->pending_requests()[1]->url());
@@ -862,7 +862,7 @@ TEST(ProxyServiceTest, CancelInProgressRequest) {
ProxyInfo info3;
TestCompletionCallback callback3;
rv = service.ResolveProxy(
- GURL("http://request3"), &info3, &callback3, NULL);
+ NULL, GURL("http://request3"), &info3, &callback3, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(3u, resolver->pending_requests().size());
EXPECT_EQ(GURL("http://request3"), resolver->pending_requests()[2]->url());
@@ -912,7 +912,7 @@ TEST(ProxyServiceTest, InitialPACScriptDownload) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info1, &callback1, NULL);
+ NULL, GURL("http://request1"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered download of PAC script.
@@ -922,13 +922,13 @@ TEST(ProxyServiceTest, InitialPACScriptDownload) {
ProxyInfo info2;
TestCompletionCallback callback2;
rv = service.ResolveProxy(
- GURL("http://request2"), &info2, &callback2, NULL);
+ NULL, GURL("http://request2"), &info2, &callback2, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info3;
TestCompletionCallback callback3;
rv = service.ResolveProxy(
- GURL("http://request3"), &info3, &callback3, NULL);
+ NULL, GURL("http://request3"), &info3, &callback3, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Nothing has been sent to the resolver yet.
@@ -990,7 +990,7 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) {
TestCompletionCallback callback1;
ProxyService::PacRequest* request1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info1, &callback1, &request1);
+ NULL, GURL("http://request1"), &info1, &callback1, &request1);
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered download of PAC script.
@@ -1001,13 +1001,13 @@ TEST(ProxyServiceTest, CancelWhilePACFetching) {
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
rv = service.ResolveProxy(
- GURL("http://request2"), &info2, &callback2, &request2);
+ NULL, GURL("http://request2"), &info2, &callback2, &request2);
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info3;
TestCompletionCallback callback3;
rv = service.ResolveProxy(
- GURL("http://request3"), &info3, &callback3, NULL);
+ NULL, GURL("http://request3"), &info3, &callback3, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Nothing has been sent to the resolver yet.
@@ -1063,14 +1063,14 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomPac) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info1, &callback1, NULL);
+ NULL, GURL("http://request1"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
rv = service.ResolveProxy(
- GURL("http://request2"), &info2, &callback2, &request2);
+ NULL, GURL("http://request2"), &info2, &callback2, &request2);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -1133,14 +1133,14 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomPac2) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info1, &callback1, NULL);
+ NULL, GURL("http://request1"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
rv = service.ResolveProxy(
- GURL("http://request2"), &info2, &callback2, &request2);
+ NULL, GURL("http://request2"), &info2, &callback2, &request2);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -1208,14 +1208,14 @@ TEST(ProxyServiceTest, FallbackFromAutodetectToCustomToManual) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info1, &callback1, NULL);
+ NULL, GURL("http://request1"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
rv = service.ResolveProxy(
- GURL("http://request2"), &info2, &callback2, &request2);
+ NULL, GURL("http://request2"), &info2, &callback2, &request2);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -1265,7 +1265,7 @@ TEST(ProxyServiceTest, BypassDoesntApplyToPac) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://www.google.com"), &info1, &callback1, NULL);
+ NULL, GURL("http://www.google.com"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -1296,7 +1296,7 @@ TEST(ProxyServiceTest, BypassDoesntApplyToPac) {
ProxyInfo info2;
TestCompletionCallback callback2;
rv = service.ResolveProxy(
- GURL("http://www.google.com"), &info2, &callback2, NULL);
+ NULL, GURL("http://www.google.com"), &info2, &callback2, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver->pending_requests().size());
@@ -1321,7 +1321,7 @@ TEST(ProxyServiceTest, ResetProxyConfigService) {
ProxyInfo info;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://request1"), &info, &callback1, NULL);
+ NULL, GURL("http://request1"), &info, &callback1, NULL);
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -1330,7 +1330,8 @@ TEST(ProxyServiceTest, ResetProxyConfigService) {
config2.auto_detect = false;
service.ResetConfigService(new MockProxyConfigService(config2));
TestCompletionCallback callback2;
- rv = service.ResolveProxy(GURL("http://request2"), &info, &callback2, NULL);
+ rv = service.ResolveProxy(
+ NULL, GURL("http://request2"), &info, &callback2, NULL);
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI());
}
@@ -1394,7 +1395,7 @@ TEST(ProxyServiceTest, UpdateConfigAfterFailedAutodetect) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://www.google.com"), &info1, &callback1, NULL);
+ NULL, GURL("http://www.google.com"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -1418,7 +1419,7 @@ TEST(ProxyServiceTest, UpdateConfigAfterFailedAutodetect) {
ProxyInfo info2;
TestCompletionCallback callback2;
rv = service.ResolveProxy(
- GURL("http://www.google.com"), &info2, &callback2, NULL);
+ NULL, GURL("http://www.google.com"), &info2, &callback2, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info2.is_direct());
@@ -1439,7 +1440,7 @@ TEST(ProxyServiceTest, UpdateConfigFromPACToDirect) {
ProxyInfo info1;
TestCompletionCallback callback1;
int rv = service.ResolveProxy(
- GURL("http://www.google.com"), &info1, &callback1, NULL);
+ NULL, GURL("http://www.google.com"), &info1, &callback1, NULL);
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -1471,7 +1472,7 @@ TEST(ProxyServiceTest, UpdateConfigFromPACToDirect) {
ProxyInfo info2;
TestCompletionCallback callback2;
rv = service.ResolveProxy(
- GURL("http://www.google.com"), &info2, &callback2, NULL);
+ NULL, GURL("http://www.google.com"), &info2, &callback2, NULL);
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info2.is_direct());
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);
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc
index 3a6d662..a472a27 100644
--- a/net/tools/fetch/fetch_client.cc
+++ b/net/tools/fetch/fetch_client.cc
@@ -57,7 +57,8 @@ class Client {
driver_->ClientStarted();
request_info_.url = url_;
request_info_.method = "GET";
- int state = transaction_->Start(&request_info_, &connect_callback_);
+ int state = transaction_->Start(
+ NULL, &request_info_, &connect_callback_);
DCHECK(state == net::ERR_IO_PENDING);
};
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 7dfad41..aa76b00 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -10,6 +10,7 @@
#include "base/stats_counters.h"
#include "base/string_util.h"
#include "net/base/load_flags.h"
+#include "net/base/load_log.h"
#include "net/base/net_errors.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/base/upload_data.h"
@@ -39,7 +40,8 @@ static URLRequestJobManager* GetJobManager() {
// URLRequest
URLRequest::URLRequest(const GURL& url, Delegate* delegate)
- : url_(url),
+ : load_log_(new net::LoadLog),
+ url_(url),
original_url_(url),
method_("GET"),
load_flags_(net::LOAD_NORMAL),
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index 5a97fc6..00ff344 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -15,6 +15,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "googleurl/src/gurl.h"
+#include "net/base/load_log.h"
#include "net/base/load_states.h"
#include "net/http/http_response_info.h"
#include "net/url_request/url_request_status.h"
@@ -485,6 +486,8 @@ class URLRequest {
URLRequestContext* context();
void set_context(URLRequestContext* context);
+ net::LoadLog* load_log() { return load_log_; }
+
// Returns the expected content size if available
int64 GetExpectedContentSize() const;
@@ -541,9 +544,14 @@ class URLRequest {
// Origin).
static std::string StripPostSpecificHeaders(const std::string& headers);
- // Contextual information used for this request (can be NULL).
+ // Contextual information used for this request (can be NULL). This contains
+ // most of the dependencies which are shared between requests (disk cache,
+ // cookie store, socket poool, etc.)
scoped_refptr<URLRequestContext> context_;
+ // Tracks the time spent in various load states throughout this request.
+ scoped_refptr<net::LoadLog> load_log_;
+
scoped_refptr<URLRequestJob> job_;
scoped_refptr<net::UploadData> upload_;
GURL url_;
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index ec3301b..bf554e8 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -581,7 +581,8 @@ void URLRequestHttpJob::StartTransaction() {
int rv;
if (transaction_.get()) {
- rv = transaction_->Start(&request_info_, &start_callback_);
+ rv = transaction_->Start(
+ request_->load_log(), &request_info_, &start_callback_);
if (rv == net::ERR_IO_PENDING)
return;
} else {
diff --git a/net/url_request/url_request_new_ftp_job.cc b/net/url_request/url_request_new_ftp_job.cc
index 72aee4d..5b16e7a 100644
--- a/net/url_request/url_request_new_ftp_job.cc
+++ b/net/url_request/url_request_new_ftp_job.cc
@@ -282,7 +282,8 @@ void URLRequestNewFtpJob::StartTransaction() {
SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
int rv;
if (transaction_.get()) {
- rv = transaction_->Start(&request_info_, &start_callback_);
+ rv = transaction_->Start(
+ request_->load_log(), &request_info_, &start_callback_);
if (rv == net::ERR_IO_PENDING)
return;
} else {