Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1495)

Unified Diff: chrome/browser/android/offline_pages/background_loader_offliner.cc

Issue 2751253004: [Offline Pages] Add UMA to record final offline request status and loading failed error code. (Closed)
Patch Set: fix unit test so DidFinishNavigation is only called once Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/background_loader_offliner.cc
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.cc b/chrome/browser/android/offline_pages/background_loader_offliner.cc
index 9b163c5ee7c1e196bcf3eca650134188c3371e59..9cd60c6e843d1350ee771d357c87cf8e05eaabe5 100644
--- a/chrome/browser/android/offline_pages/background_loader_offliner.cc
+++ b/chrome/browser/android/offline_pages/background_loader_offliner.cc
@@ -44,6 +44,23 @@ class OfflinerData : public content::WebContentsUserData<OfflinerData> {
BackgroundLoaderOffliner* offliner_;
};
+std::string AddHistogramSuffix(const ClientId& client_id,
+ const char* histogram_name) {
+ if (client_id.name_space.empty()) {
+ NOTREACHED();
+ return histogram_name;
+ }
+ std::string adjusted_histogram_name(histogram_name);
+ adjusted_histogram_name += "." + client_id.name_space;
+ return adjusted_histogram_name;
+}
+
+void RecordErrorCauseUMA(const ClientId& client_id, net::Error error_code) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ AddHistogramSuffix(client_id,
+ "OfflinePages.Background.BackgroundLoadingFailedCode"),
+ std::abs(error_code));
+}
} // namespace
BackgroundLoaderOffliner::BackgroundLoaderOffliner(
@@ -231,7 +248,8 @@ void BackgroundLoaderOffliner::DidFinishNavigation(
// If there was an error of any kind (certificate, client, DNS, etc),
// Mark as error page. Resetting here causes RecordNavigationMetrics to crash.
if (navigation_handle->IsErrorPage()) {
- // TODO(chili): we need to UMA this.
+ RecordErrorCauseUMA(pending_request_->client_id(),
+ navigation_handle->GetNetErrorCode());
switch (navigation_handle->GetNetErrorCode()) {
case net::ERR_ACCESS_DENIED:
case net::ERR_ADDRESS_INVALID:
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698