| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 ASH_METRICS_USER_METRICS_RECORDER_H_ | 5 #ifndef ASH_METRICS_USER_METRICS_RECORDER_H_ |
| 6 #define ASH_METRICS_USER_METRICS_RECORDER_H_ | 6 #define ASH_METRICS_USER_METRICS_RECORDER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/metrics/task_switch_metrics_recorder.h" | 9 #include "ash/metrics/task_switch_metrics_recorder.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 public: | 138 public: |
| 139 // Creates a UserMetricsRecorder that records metrics periodically. Equivalent | 139 // Creates a UserMetricsRecorder that records metrics periodically. Equivalent |
| 140 // to calling UserMetricsRecorder(true). | 140 // to calling UserMetricsRecorder(true). |
| 141 UserMetricsRecorder(); | 141 UserMetricsRecorder(); |
| 142 | 142 |
| 143 virtual ~UserMetricsRecorder(); | 143 virtual ~UserMetricsRecorder(); |
| 144 | 144 |
| 145 // Records an Ash owned user action. | 145 // Records an Ash owned user action. |
| 146 void RecordUserMetricsAction(ash::UserMetricsAction action); | 146 void RecordUserMetricsAction(ash::UserMetricsAction action); |
| 147 | 147 |
| 148 TaskSwitchMetricsRecorder& task_switch_metrics_recorder() { |
| 149 return task_switch_metrics_recorder_; |
| 150 } |
| 151 |
| 148 private: | 152 private: |
| 149 friend class test::UserMetricsRecorderTestAPI; | 153 friend class test::UserMetricsRecorderTestAPI; |
| 150 | 154 |
| 151 // Creates a UserMetricsRecorder and will only record periodic metrics if | 155 // Creates a UserMetricsRecorder and will only record periodic metrics if |
| 152 // |record_periodic_metrics| is true. This is used by tests that do not want | 156 // |record_periodic_metrics| is true. This is used by tests that do not want |
| 153 // the timer to be started. | 157 // the timer to be started. |
| 154 // TODO(bruthig): Add a constructor that accepts a base::RepeatingTimer so | 158 // TODO(bruthig): Add a constructor that accepts a base::RepeatingTimer so |
| 155 // that tests can inject a test double that can be controlled by the test. The | 159 // that tests can inject a test double that can be controlled by the test. The |
| 156 // missing piece is a suitable base::RepeatingTimer test double. | 160 // missing piece is a suitable base::RepeatingTimer test double. |
| 157 explicit UserMetricsRecorder(bool record_periodic_metrics); | 161 explicit UserMetricsRecorder(bool record_periodic_metrics); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 170 base::RepeatingTimer<UserMetricsRecorder> timer_; | 174 base::RepeatingTimer<UserMetricsRecorder> timer_; |
| 171 | 175 |
| 172 TaskSwitchMetricsRecorder task_switch_metrics_recorder_; | 176 TaskSwitchMetricsRecorder task_switch_metrics_recorder_; |
| 173 | 177 |
| 174 DISALLOW_COPY_AND_ASSIGN(UserMetricsRecorder); | 178 DISALLOW_COPY_AND_ASSIGN(UserMetricsRecorder); |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } // namespace ash | 181 } // namespace ash |
| 178 | 182 |
| 179 #endif // ASH_METRICS_USER_METRICS_RECORDER_H_ | 183 #endif // ASH_METRICS_USER_METRICS_RECORDER_H_ |
| OLD | NEW |