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..6dba559b38d2d7342bcfd600189f205c319c3c9b |
--- /dev/null |
+++ b/content/browser/background_sync/background_sync_metrics.h |
@@ -0,0 +1,52 @@ |
+// 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" |
+ |
+namespace content { |
+ |
+class BackgroundSyncMetrics { |
Alexei Svitkine (slow)
2015/07/09 21:02:57
Add a comment explaining the purpose of this class
iclelland
2015/07/10 14:57:26
Done.
|
+ public: |
+ enum RegistrationResult { |
+ REGISTRATION_RESULT_SUCCEEDED, |
+ REGISTRATION_RESULT_FAILED, |
+ REGISTRATION_RESULT_DUPLICATE, |
+ NUM_REGISTRATION_RESULT_TYPES |
+ }; |
+ |
+ // Counts the number of times that the device was woken up for syncs. |
+ // |success| indicates whether any events successfully completed. |
+ static void CountWakeUpForSync(SyncPeriodicity periodicity, bool success); |
+ |
+ // Records the time taken starting the browser process to fire a sync. |
+ static void RecordWakeUpTime(const base::TimeDelta& time); |
+ |
+ // 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. |
+ static void RecordSyncEventHandlingTime(const base::TimeDelta& time); |
+ |
+ // Records the result of trying to register a sync. |could_fire| indicates |
+ // whether the network/power was sufficient for the sync to fire immediately |
+ // at the time it was registered. |
+ static void CountRegistration(SyncPeriodicity periodicity, |
+ bool could_fire, |
+ RegistrationResult result); |
+ |
+ // Records the result of trying to unregister a sync. |
+ static void CountUnregistration(SyncPeriodicity periodicity, bool success); |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ |