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 #include "content/browser/background_sync/background_sync_manager.h" | |
12 | |
13 namespace content { | |
14 | |
15 // This class contains the logic for recording usage metrics for the Background | |
16 // Sync API. It is stateless, containing only static methods, so it can be used | |
17 // by any of the Background Sync code, without needing to be instantiated | |
18 // explicitly. | |
19 class BackgroundSyncMetrics { | |
20 public: | |
21 enum RegistrationCouldFire { | |
22 REGISTRATION_COULD_NOT_FIRE, | |
23 REGISTRATION_COULD_FIRE | |
24 }; | |
25 | |
26 enum RegistrationIsDuplicate { | |
27 REGISTRATION_IS_NOT_DUPLICATE, | |
28 REGISTRATION_IS_DUPLICATE | |
29 }; | |
30 | |
31 // Records the result of a single sync event firing. | |
32 static void RecordEventResult(SyncPeriodicity periodicity, bool result); | |
33 | |
34 // 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.
| |
35 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.
| |
36 | |
37 // Records the result of trying to register a sync. |could_fire| indicates | |
38 // 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.
| |
39 // at the time it was registered. | |
40 static void CountRegistration( | |
41 SyncPeriodicity periodicity, | |
42 RegistrationCouldFire could_fire, | |
43 RegistrationIsDuplicate registration_is_duplicate, | |
44 BackgroundSyncManager::ErrorType result); | |
45 | |
46 // Records the result of trying to unregister a sync. | |
47 static void CountUnregistration(SyncPeriodicity periodicity, | |
48 BackgroundSyncManager::ErrorType result); | |
49 | |
50 private: | |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics); | |
52 }; | |
53 | |
54 } // namespace content | |
55 | |
56 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | |
OLD | NEW |