Chromium Code Reviews| 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..c6397b1bbbaab7d7f80ace1b8a3b1a8e3d539f87 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. |
|
fgorski
2016/07/12 22:17:06
where is the comment about not reporting loaded or
dougarnett
2016/07/12 23:07:59
Ok, added comment about the two interim status cod
|
| +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( |
| @@ -92,6 +102,11 @@ void RequestCoordinator::StopProcessing() { |
| if (offliner_ && is_busy_) |
| offliner_->Cancel(); |
| + // Stopping offliner means it will not call callback. |
| + last_offlining_status_ = |
| + Offliner::RequestStatus::REQUEST_COORDINATOR_CANCELED; |
| + RecordOfflinerResultUMA(last_offlining_status_); |
| + |
| // Let the scheduler know we are done processing. |
| scheduler_callback_.Run(true); |
| } |
| @@ -172,6 +187,7 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request, |
| "Saved", |
| request.request_id()); |
| last_offlining_status_ = status; |
| + RecordOfflinerResultUMA(last_offlining_status_); |
| watchdog_timer_.Stop(); |
| is_busy_ = false; |