Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | |
| 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "content/browser/background_sync/background_sync.pb.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 // This class contains the logic for recording usage metrics for the Background | |
| 15 // Sync API. It is stateless, containing only static methods, so it can be used | |
| 16 // by any of the Background Sync code, without needing to be instantiated | |
| 17 // explicitly. | |
| 18 class BackgroundSyncMetrics { | |
| 19 public: | |
| 20 enum RegistrationResult { | |
| 21 REGISTRATION_RESULT_SUCCEEDED, | |
| 22 REGISTRATION_RESULT_FAILED, | |
| 23 REGISTRATION_RESULT_DUPLICATE, | |
| 24 NUM_REGISTRATION_RESULT_TYPES | |
| 25 }; | |
|
jkarlin
2015/07/13 16:51:13
Why not use BackgroundSyncManager::ErrorType?
iclelland
2015/07/13 19:34:31
We need to mirror the enum in histograms.xml, whic
jkarlin
2015/07/14 15:54:10
Thanks for explaining, I hadn't noticed the "dupli
| |
| 26 | |
| 27 // Records the result of a single sync event firing. | |
| 28 static void RecordEventResult(SyncPeriodicity periodicity, bool result); | |
| 29 | |
| 30 // Records the total time spent running all sync events. | |
| 31 static void RecordSyncEventHandlingTime(const base::TimeDelta& time); | |
| 32 | |
| 33 // Records the result of trying to register a sync. |could_fire| indicates | |
| 34 // whether the network/power was sufficient for the sync to fire immediately | |
| 35 // at the time it was registered. | |
| 36 static void CountRegistration(SyncPeriodicity periodicity, | |
| 37 bool could_fire, | |
| 38 RegistrationResult result); | |
| 39 | |
| 40 // Records the result of trying to unregister a sync. | |
| 41 static void CountUnregistration(SyncPeriodicity periodicity, bool success); | |
| 42 | |
| 43 private: | |
| 44 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics); | |
| 45 }; | |
| 46 | |
| 47 } // namespace content | |
| 48 | |
| 49 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | |
| OLD | NEW |