diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 00:56:48 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 00:56:48 +0000 |
commit | bddf5449aa251cd6fca3f9c679ca80a21719ed41 (patch) | |
tree | cc9816da2c254dea80c38913cb2138ab7504e8be /chrome/browser/renderer_host | |
parent | bcd1d2b2e4f77402b9e0588b6bf09c953d0954de (diff) | |
download | chromium_src-bddf5449aa251cd6fca3f9c679ca80a21719ed41.zip chromium_src-bddf5449aa251cd6fca3f9c679ca80a21719ed41.tar.gz chromium_src-bddf5449aa251cd6fca3f9c679ca80a21719ed41.tar.bz2 |
Add an UMA histogram that counts the types of network error codes that main frame page loads fail with:
Net.ErrorCodesForMainFrame
BUG=41811
Review URL: http://codereview.chromium.org/1568024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index e2278cb..357a826 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -168,6 +168,17 @@ void PopulateResourceResponse(URLRequest* request, &response->response_head.appcache_manifest_url); } +// Returns a list of all the possible error codes from the network module. +// Note that the error codes are all positive (since histograms expect positive +// sample values). +std::vector<int> GetAllNetErrorCodes() { + std::vector<int> all_error_codes; +#define NET_ERROR(label, value) all_error_codes.push_back(-(value)); +#include "net/base/net_error_list.h" +#undef NET_ERROR + return all_error_codes; +} + } // namespace ResourceDispatcherHost::ResourceDispatcherHost() @@ -1343,6 +1354,15 @@ void ResourceDispatcherHost::OnResponseCompleted(URLRequest* request) { RESOURCE_LOG("OnResponseCompleted: " << request->url().spec()); ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); + // If the load for a main frame has failed, track it in a histogram, + // since it will probably cause the user to see an error page. + if (!request->status().is_success() && + info->resource_type() == ResourceType::MAIN_FRAME) { + UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", + -request->status().os_error(), + GetAllNetErrorCodes()); + } + std::string security_info; const net::SSLInfo& ssl_info = request->ssl_info(); if (ssl_info.cert != NULL) { |