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

Unified Diff: components/offline_pages/background/request_coordinator.cc

Issue 2104393002: Adds UMA for PrerenderingOffliner request processing result status. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rename in unittest (from merge). Created 4 years, 5 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
Index: components/offline_pages/background/request_coordinator.cc
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index 6292aa8cc7b24ddb6fc7fe430d8529531f288589..d5f1081fdb8bdaef03986e828911a138999bb52d 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "components/offline_pages/background/offliner_factory.h"
#include "components/offline_pages/background/offliner_policy.h"
@@ -19,6 +20,15 @@
namespace offline_pages {
namespace {
+
+// Records the final request status UMA for an offlining request. This should
+// only be called once per Offliner::LoadAndSave request.
+void RecordOfflinerResultUMA(Offliner::RequestStatus request_status) {
+ UMA_HISTOGRAM_ENUMERATION("OfflinePages.Background.OfflinerRequestStatus",
+ request_status,
+ Offliner::RequestStatus::STATUS_COUNT);
+}
+
// TODO(dougarnett/petewil): Move to Policy object. Also consider lower minimum
// battery percentage once there is some processing time limits in place.
const Scheduler::TriggerConditions kUserRequestTriggerConditions(
@@ -89,8 +99,11 @@ void RequestCoordinator::UpdateRequestCallback(
void RequestCoordinator::StopProcessing() {
is_canceled_ = true;
- if (offliner_ && is_busy_)
+ if (offliner_ && is_busy_) {
offliner_->Cancel();
+ RecordOfflinerResultUMA(
+ Offliner::RequestStatus::REQUEST_COORDINATOR_CANCELED);
+ }
// Let the scheduler know we are done processing.
scheduler_callback_.Run(true);
@@ -171,6 +184,7 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
request.client_id().name_space,
"Saved",
request.request_id());
+ RecordOfflinerResultUMA(status);
last_offlining_status_ = status;
watchdog_timer_.Stop();

Powered by Google App Engine
This is Rietveld 408576698