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

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

Issue 2388303007: [Offline Pages] Adds UMA for result of attempts to immediately start background loading. (Closed)
Patch Set: Two comment improvements Created 4 years, 2 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 | « components/offline_pages/background/request_coordinator.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ce1a49e2e2e6dcd44f84eebb3a3ddb00132a3b89..78adcaa468d825854a4353af485341518fd9f507 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -371,30 +371,42 @@ bool RequestCoordinator::StartProcessing(
}
void RequestCoordinator::StartProcessingIfConnected() {
+ OfflinerImmediateStartStatus immediate_start_status = TryImmediateStart();
+ UMA_HISTOGRAM_ENUMERATION(
+ "OfflinePages.Background.ImmediateStartStatus", immediate_start_status,
+ RequestCoordinator::OfflinerImmediateStartStatus::STATUS_COUNT);
+}
+
+RequestCoordinator::OfflinerImmediateStartStatus
+RequestCoordinator::TryImmediateStart() {
// Make sure not already busy processing.
- if (is_busy_) return;
+ if (is_busy_)
+ return OfflinerImmediateStartStatus::BUSY;
// Make sure we are not on svelte device to start immediately.
- if (base::SysInfo::IsLowEndDevice()) return;
+ if (base::SysInfo::IsLowEndDevice())
+ return OfflinerImmediateStartStatus::NOT_STARTED_ON_SVELTE;
// Make sure we have reasonable network quality (or at least a connection).
if (network_quality_estimator_) {
// TODO(dougarnett): Add UMA for quality type experienced.
net::EffectiveConnectionType quality =
network_quality_estimator_->GetEffectiveConnectionType();
- if (quality < net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_2G) {
- return;
- }
+ if (quality < net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_2G)
+ return OfflinerImmediateStartStatus::WEAK_CONNECTION;
} else if (GetConnectionType() ==
net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) {
- return;
+ return OfflinerImmediateStartStatus::NO_CONNECTION;
}
// Start processing with manufactured conservative battery conditions
// (i.e., assume no battery).
// TODO(dougarnett): Obtain actual battery conditions (from Android/Java).
DeviceConditions device_conditions(false, 0, GetConnectionType());
- StartProcessing(device_conditions, base::Bind(&EmptySchedulerCallback));
+ if (StartProcessing(device_conditions, base::Bind(&EmptySchedulerCallback)))
+ return OfflinerImmediateStartStatus::STARTED;
+ else
+ return OfflinerImmediateStartStatus::NOT_ACCEPTED;
}
void RequestCoordinator::TryNextRequest() {
« no previous file with comments | « components/offline_pages/background/request_coordinator.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698