summaryrefslogtreecommitdiffstats
path: root/net/base/host_resolver_impl.cc
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 23:19:16 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 23:19:16 +0000
commit1302488d6467c0744e0e2dae3a40c68d62a58374 (patch)
treeb3d1136d692fa6c73badab2bafa0405d75f89d6d /net/base/host_resolver_impl.cc
parent61b0cc2d099df700ff3e4c46b74a95a09b63c8a7 (diff)
downloadchromium_src-1302488d6467c0744e0e2dae3a40c68d62a58374.zip
chromium_src-1302488d6467c0744e0e2dae3a40c68d62a58374.tar.gz
chromium_src-1302488d6467c0744e0e2dae3a40c68d62a58374.tar.bz2
Added logging of the attempt number whenever we start
Host resolution (DoLookup) and whenever host resolution is completed (OnLookupComplete). BUG=82592 TEST=about:net-internals and click on Events. In HOST_RESOLVER_IMPL_JOB, there would be log entries for attempts (HOST_RESOLVER_IMPL_ATTEMPT_STARTED and HOST_RESOLVER_IMPL_ATTEMPT_FINISHED). R=eroman,mmenke Review URL: http://codereview.chromium.org/7021021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl.cc')
-rw-r--r--net/base/host_resolver_impl.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 371692a..59d1b32 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -134,13 +134,19 @@ static int ResolveAddrInfo(HostResolverProc* resolver_proc,
// Extra parameters to attach to the NetLog when the resolve failed.
class HostResolveFailedParams : public NetLog::EventParameters {
public:
- HostResolveFailedParams(int net_error, int os_error)
- : net_error_(net_error),
+ HostResolveFailedParams(uint32 attempt_number,
+ int net_error,
+ int os_error)
+ : attempt_number_(attempt_number),
+ net_error_(net_error),
os_error_(os_error) {
}
virtual Value* ToValue() const {
DictionaryValue* dict = new DictionaryValue();
+ if (attempt_number_)
+ dict->SetInteger("attempt_number", attempt_number_);
+
dict->SetInteger("net_error", net_error_);
if (os_error_) {
@@ -167,6 +173,7 @@ class HostResolveFailedParams : public NetLog::EventParameters {
}
private:
+ const uint32 attempt_number_;
const int net_error_;
const int os_error_;
};
@@ -433,6 +440,12 @@ class HostResolverImpl::Job
start_time, attempt_number_, ERR_UNEXPECTED, 0));
return;
}
+
+ net_log_.AddEvent(
+ NetLog::TYPE_HOST_RESOLVER_IMPL_ATTEMPT_STARTED,
+ make_scoped_refptr(new NetLogIntegerParameter(
+ "attempt_number", attempt_number_)));
+
// Post a task to check if we get the results within a given time.
// OnCheckForComplete has the potential for starting a new attempt on a
// different worker thread if none of our outstanding attempts have
@@ -565,6 +578,15 @@ class HostResolverImpl::Job
bool was_retry_attempt = attempt_number > 1;
if (!was_cancelled()) {
+ scoped_refptr<NetLog::EventParameters> params;
+ if (error != OK) {
+ params = new HostResolveFailedParams(attempt_number, error, os_error);
+ } else {
+ params = new NetLogIntegerParameter("attempt_number", attempt_number_);
+ }
+ net_log_.AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_ATTEMPT_FINISHED,
+ params);
+
// If host is already resolved, then record data and return.
if (was_completed()) {
// If this is the first attempt that is finishing later, then record
@@ -601,7 +623,7 @@ class HostResolverImpl::Job
scoped_refptr<NetLog::EventParameters> params;
if (error != OK) {
- params = new HostResolveFailedParams(error, os_error);
+ params = new HostResolveFailedParams(0, error, os_error);
} else {
params = new AddressListNetLogParam(results_);
}
@@ -1407,7 +1429,7 @@ void HostResolverImpl::OnFinishRequest(const BoundNetLog& source_net_log,
// Log some extra parameters on failure for synchronous requests.
scoped_refptr<NetLog::EventParameters> params;
if (!was_resolved) {
- params = new HostResolveFailedParams(net_error, os_error);
+ params = new HostResolveFailedParams(0, net_error, os_error);
}
request_net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST, params);