| Index: content/browser/background_sync/background_sync_metrics.cc
|
| diff --git a/content/browser/background_sync/background_sync_metrics.cc b/content/browser/background_sync/background_sync_metrics.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6524c1e2d3108bbe5d180e30c899cd65e3d572ca
|
| --- /dev/null
|
| +++ b/content/browser/background_sync/background_sync_metrics.cc
|
| @@ -0,0 +1,80 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/background_sync/background_sync_metrics.h"
|
| +
|
| +#include "base/metrics/histogram_macros.h"
|
| +#include "base/metrics/user_metrics_action.h"
|
| +
|
| +namespace content {
|
| +
|
| +void BackgroundSyncMetrics::CountWakeUpForSync(SyncPeriodicity periodicity,
|
| + bool success) {
|
| + switch (periodicity) {
|
| + case SYNC_ONE_SHOT:
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.WakeUp.OneShot", success);
|
| + return;
|
| + case SYNC_PERIODIC:
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.WakeUp.Periodic", success);
|
| + return;
|
| + }
|
| + NOTREACHED();
|
| +}
|
| +
|
| +void BackgroundSyncMetrics::RecordWakeUpTime(const base::TimeDelta& time) {
|
| + UMA_HISTOGRAM_MEDIUM_TIMES("BackgroundSync.WakeUp.Time", time);
|
| +}
|
| +
|
| +void BackgroundSyncMetrics::RecordEventResult(SyncPeriodicity periodicity,
|
| + bool result) {
|
| + switch (periodicity) {
|
| + case SYNC_ONE_SHOT:
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.OneShotResult", result);
|
| + return;
|
| + case SYNC_PERIODIC:
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.PeriodicResult", result);
|
| + return;
|
| + }
|
| + NOTREACHED();
|
| +}
|
| +
|
| +void BackgroundSyncMetrics::RecordSyncEventHandlingTime(
|
| + const base::TimeDelta& time) {
|
| + UMA_HISTOGRAM_MEDIUM_TIMES("BackgroundSync.Event.Time", time);
|
| +}
|
| +
|
| +void BackgroundSyncMetrics::CountRegistration(SyncPeriodicity periodicity,
|
| + bool could_fire,
|
| + RegistrationResult result) {
|
| + switch (periodicity) {
|
| + case SYNC_ONE_SHOT:
|
| + UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot", result,
|
| + NUM_REGISTRATION_RESULT_TYPES);
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.CouldFire",
|
| + could_fire);
|
| + return;
|
| + case SYNC_PERIODIC:
|
| + UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result,
|
| + NUM_REGISTRATION_RESULT_TYPES);
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.Periodic.CouldFire",
|
| + could_fire);
|
| + return;
|
| + }
|
| + NOTREACHED();
|
| +}
|
| +
|
| +void BackgroundSyncMetrics::CountUnregistration(SyncPeriodicity periodicity,
|
| + bool success) {
|
| + switch (periodicity) {
|
| + case SYNC_ONE_SHOT:
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Unregistration.OneShot", success);
|
| + return;
|
| + case SYNC_PERIODIC:
|
| + UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Unregistration.Periodic", success);
|
| + return;
|
| + }
|
| + NOTREACHED();
|
| +}
|
| +
|
| +} // namespace content
|
|
|