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 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.
| |
15 public: | |
16 enum RegistrationResult { | |
17 REGISTRATION_RESULT_SUCCEEDED, | |
18 REGISTRATION_RESULT_FAILED, | |
19 REGISTRATION_RESULT_DUPLICATE, | |
20 NUM_REGISTRATION_RESULT_TYPES | |
21 }; | |
22 | |
23 // Counts the number of times that the device was woken up for syncs. | |
24 // |success| indicates whether any events successfully completed. | |
25 static void CountWakeUpForSync(SyncPeriodicity periodicity, bool success); | |
26 | |
27 // Records the time taken starting the browser process to fire a sync. | |
28 static void RecordWakeUpTime(const base::TimeDelta& time); | |
29 | |
30 // Records the result of a single sync event firing. | |
31 static void RecordEventResult(SyncPeriodicity periodicity, bool result); | |
32 | |
33 // Records the total time spent running all sync events. | |
34 static void RecordSyncEventHandlingTime(const base::TimeDelta& time); | |
35 | |
36 // Records the result of trying to register a sync. |could_fire| indicates | |
37 // whether the network/power was sufficient for the sync to fire immediately | |
38 // at the time it was registered. | |
39 static void CountRegistration(SyncPeriodicity periodicity, | |
40 bool could_fire, | |
41 RegistrationResult result); | |
42 | |
43 // Records the result of trying to unregister a sync. | |
44 static void CountUnregistration(SyncPeriodicity periodicity, bool success); | |
45 | |
46 private: | |
47 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics); | |
48 }; | |
49 | |
50 } // namespace content | |
51 | |
52 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | |
OLD | NEW |