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

Unified Diff: content/browser/background_sync/background_sync_metrics.h

Issue 1227363002: [Background Sync] Gather UMA data for Background Sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit conversion to boolean in UMA recording Created 5 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: content/browser/background_sync/background_sync_metrics.h
diff --git a/content/browser/background_sync/background_sync_metrics.h b/content/browser/background_sync/background_sync_metrics.h
new file mode 100644
index 0000000000000000000000000000000000000000..01ece3f146990fd7fb9db83f5cc2f5154f046c8d
--- /dev/null
+++ b/content/browser/background_sync/background_sync_metrics.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_
+#define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_
+
+#include "base/macros.h"
+#include "base/time/time.h"
+#include "content/browser/background_sync/background_sync.pb.h"
+#include "content/browser/background_sync/background_sync_manager.h"
+
+namespace content {
+
+// This class contains the logic for recording usage metrics for the Background
+// Sync API. It is stateless, containing only static methods, so it can be used
+// by any of the Background Sync code, without needing to be instantiated
+// explicitly.
+class BackgroundSyncMetrics {
+ public:
+ enum RegistrationCouldFire {
+ REGISTRATION_COULD_NOT_FIRE,
+ REGISTRATION_COULD_FIRE
+ };
+
+ enum RegistrationIsDuplicate {
+ REGISTRATION_IS_NOT_DUPLICATE,
+ REGISTRATION_IS_DUPLICATE
+ };
+
+ // Records the result of a single sync event firing.
+ static void RecordEventResult(SyncPeriodicity periodicity, bool result);
+
+ // Records the total time spent running all sync events.
jkarlin 2015/07/15 17:17:06 This makes it sound like it's counting up all sync
iclelland 2015/07/15 18:01:35 Done.
+ static void RecordSyncEventHandlingTime(const base::TimeDelta& time);
jkarlin 2015/07/15 17:17:06 Perhaps RecordBatchSyncEventHandlingTime to make i
iclelland 2015/07/15 18:01:35 Done.
+
+ // Records the result of trying to register a sync. |could_fire| indicates
+ // whether the network/power was sufficient for the sync to fire immediately
jkarlin 2015/07/15 17:17:06 network/power is specific and the conditions might
iclelland 2015/07/15 18:01:35 Done.
+ // at the time it was registered.
+ static void CountRegistration(
+ SyncPeriodicity periodicity,
+ RegistrationCouldFire could_fire,
+ RegistrationIsDuplicate registration_is_duplicate,
+ BackgroundSyncManager::ErrorType result);
+
+ // Records the result of trying to unregister a sync.
+ static void CountUnregistration(SyncPeriodicity periodicity,
+ BackgroundSyncManager::ErrorType result);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_

Powered by Google App Engine
This is Rietveld 408576698