diff options
author | mmenke <mmenke@chromium.org> | 2015-06-18 14:19:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-18 21:20:18 +0000 |
commit | 41f458e2f9c483d088f198b171fc4f2fe5fd22a2 (patch) | |
tree | 1e440f38750d14648a5d1e20fd98df5c7101464f /net | |
parent | a947f3b0181f51a94a18bd80227960037a936c70 (diff) | |
download | chromium_src-41f458e2f9c483d088f198b171fc4f2fe5fd22a2.zip chromium_src-41f458e2f9c483d088f198b171fc4f2fe5fd22a2.tar.gz chromium_src-41f458e2f9c483d088f198b171fc4f2fe5fd22a2.tar.bz2 |
Add histograms for how often 4xx/5xx responses have bodies.
These are intended to be removed in a release or two, once we have
enough information to decide how important it is to show error pages
when they don't have bodies.
BUG=331745
Review URL: https://codereview.chromium.org/1194643003
Cr-Commit-Position: refs/heads/master@{#335127}
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request_job.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index b333dc1..14c5c8f 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/compiler_specific.h" #include "base/location.h" +#include "base/metrics/histogram_macros.h" #include "base/power_monitor/power_monitor.h" #include "base/profiler/scoped_tracker.h" #include "base/single_thread_task_runner.h" @@ -17,6 +18,7 @@ #include "net/base/auth.h" #include "net/base/host_port_pair.h" #include "net/base/io_buffer.h" +#include "net/base/load_flags.h" #include "net/base/load_states.h" #include "net/base/net_errors.h" #include "net/base/network_delegate.h" @@ -543,6 +545,24 @@ void URLRequestJob::NotifyDone(const URLRequestStatus &status) { } request_->set_status(status); } + + // If the request succeeded (And wasn't cancelled) and the response code was + // 4xx or 5xx, record whether or not the main frame was blank. This is + // intended to be a short-lived histogram, used to figure out how important + // fixing http://crbug.com/331745 is. + if (request_->status().is_success()) { + int response_code = GetResponseCode(); + if (400 <= response_code && response_code <= 599) { + bool page_has_content = (postfilter_bytes_read_ != 0); + if (request_->load_flags() & net::LOAD_MAIN_FRAME) { + UMA_HISTOGRAM_BOOLEAN("Net.ErrorResponseHasContentMainFrame", + page_has_content); + } else { + UMA_HISTOGRAM_BOOLEAN("Net.ErrorResponseHasContentNonMainFrame", + page_has_content); + } + } + } } // Complete this notification later. This prevents us from re-entering the |