OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_METRICS_DAILY_EVENT_H_ | 5 #ifndef COMPONENTS_METRICS_DAILY_EVENT_H_ |
6 #define COMPONENTS_METRICS_DAILY_EVENT_H_ | 6 #define COMPONENTS_METRICS_DAILY_EVENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_vector.h" | |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 | 13 |
14 class PrefRegistrySimple; | 14 class PrefRegistrySimple; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
17 namespace metrics { | 17 namespace metrics { |
18 | 18 |
19 // DailyEvent is used for throttling an event to about once per day, even if | 19 // DailyEvent is used for throttling an event to about once per day, even if |
20 // the program is restarted more frequently. It is based on local machine | 20 // the program is restarted more frequently. It is based on local machine |
21 // time, so it could be fired more often if the clock is changed. | 21 // time, so it could be fired more often if the clock is changed. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 PrefService* pref_service_; | 73 PrefService* pref_service_; |
74 | 74 |
75 // The name of the preference to store the last fired time in. | 75 // The name of the preference to store the last fired time in. |
76 // Calling code should ensure this outlives the DailyEvent. | 76 // Calling code should ensure this outlives the DailyEvent. |
77 const char* pref_name_; | 77 const char* pref_name_; |
78 | 78 |
79 // The name of the histogram to record intervals. | 79 // The name of the histogram to record intervals. |
80 std::string histogram_name_; | 80 std::string histogram_name_; |
81 | 81 |
82 // A list of observers. | 82 // A list of observers. |
83 ScopedVector<Observer> observers_; | 83 std::vector<std::unique_ptr<Observer>> observers_; |
84 | 84 |
85 // The time that the daily event was last fired. | 85 // The time that the daily event was last fired. |
86 base::Time last_fired_; | 86 base::Time last_fired_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(DailyEvent); | 88 DISALLOW_COPY_AND_ASSIGN(DailyEvent); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace metrics | 91 } // namespace metrics |
92 | 92 |
93 #endif // COMPONENTS_METRICS_DAILY_EVENT_H_ | 93 #endif // COMPONENTS_METRICS_DAILY_EVENT_H_ |
OLD | NEW |