| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ |
| 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/background_sync/background_sync.pb.h" | 10 #include "content/browser/background_sync/background_sync.pb.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 REGISTRATION_COULD_NOT_FIRE, | 22 REGISTRATION_COULD_NOT_FIRE, |
| 23 REGISTRATION_COULD_FIRE | 23 REGISTRATION_COULD_FIRE |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 enum RegistrationIsDuplicate { | 26 enum RegistrationIsDuplicate { |
| 27 REGISTRATION_IS_NOT_DUPLICATE, | 27 REGISTRATION_IS_NOT_DUPLICATE, |
| 28 REGISTRATION_IS_DUPLICATE | 28 REGISTRATION_IS_DUPLICATE |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // Records the start of a sync event. | 31 // Records the start of a sync event. |
| 32 static void RecordEventStarted(SyncPeriodicity periodicity, | 32 static void RecordEventStarted(bool startedin_foreground); |
| 33 bool startedin_foreground); | |
| 34 | 33 |
| 35 // Records the result of a single sync event firing. | 34 // Records the result of a single sync event firing. |
| 36 static void RecordEventResult(SyncPeriodicity periodicity, | 35 static void RecordEventResult(bool result, bool finished_in_foreground); |
| 37 bool result, | |
| 38 bool finished_in_foreground); | |
| 39 | 36 |
| 40 // Records the result of running a batch of sync events, including the total | 37 // Records the result of running a batch of sync events, including the total |
| 41 // time spent, and the batch size. | 38 // time spent, and the batch size. |
| 42 static void RecordBatchSyncEventComplete(const base::TimeDelta& time, | 39 static void RecordBatchSyncEventComplete(const base::TimeDelta& time, |
| 43 int number_of_batched_sync_events); | 40 int number_of_batched_sync_events); |
| 44 | 41 |
| 45 // Records the result of successfully registering a sync. |could_fire| | 42 // Records the result of successfully registering a sync. |could_fire| |
| 46 // indicates whether the conditions were sufficient for the sync to fire | 43 // indicates whether the conditions were sufficient for the sync to fire |
| 47 // immediately at the time it was registered. | 44 // immediately at the time it was registered. |
| 48 static void CountRegisterSuccess( | 45 static void CountRegisterSuccess( |
| 49 SyncPeriodicity periodicity, | |
| 50 RegistrationCouldFire could_fire, | 46 RegistrationCouldFire could_fire, |
| 51 RegistrationIsDuplicate registration_is_duplicate); | 47 RegistrationIsDuplicate registration_is_duplicate); |
| 52 | 48 |
| 53 // Records the status of a failed sync registration. | 49 // Records the status of a failed sync registration. |
| 54 static void CountRegisterFailure(SyncPeriodicity periodicity, | 50 static void CountRegisterFailure(BackgroundSyncStatus status); |
| 55 BackgroundSyncStatus status); | |
| 56 | 51 |
| 57 // Records the result of trying to unregister a sync. | 52 // Records the result of trying to unregister a sync. |
| 58 static void CountUnregister(SyncPeriodicity periodicity, | 53 static void CountUnregister(BackgroundSyncStatus result); |
| 59 BackgroundSyncStatus result); | |
| 60 | 54 |
| 61 private: | 55 private: |
| 62 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics); | 56 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundSyncMetrics); |
| 63 }; | 57 }; |
| 64 | 58 |
| 65 } // namespace content | 59 } // namespace content |
| 66 | 60 |
| 67 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ | 61 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_METRICS_H_ |
| OLD | NEW |