OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ |
6 #define CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 private: | 39 private: |
40 // Class that listens for changes to the login state. When a normal user logs | 40 // Class that listens for changes to the login state. When a normal user logs |
41 // in, it updates PerfProvider to start collecting data. | 41 // in, it updates PerfProvider to start collecting data. |
42 class LoginObserver : public chromeos::LoginState::Observer { | 42 class LoginObserver : public chromeos::LoginState::Observer { |
43 public: | 43 public: |
44 explicit LoginObserver(PerfProvider* perf_provider); | 44 explicit LoginObserver(PerfProvider* perf_provider); |
45 | 45 |
46 // Called when either the login state or the logged in user type changes. | 46 // Called when either the login state or the logged in user type changes. |
47 // Activates |perf_provider_| to start collecting. | 47 // Activates |perf_provider_| to start collecting. |
48 virtual void LoggedInStateChanged() OVERRIDE; | 48 virtual void LoggedInStateChanged() override; |
49 | 49 |
50 private: | 50 private: |
51 // Points to a PerfProvider instance that can be turned on or off based on | 51 // Points to a PerfProvider instance that can be turned on or off based on |
52 // the login state. | 52 // the login state. |
53 PerfProvider* perf_provider_; | 53 PerfProvider* perf_provider_; |
54 }; | 54 }; |
55 | 55 |
56 // Called when a suspend finishes. This is either a successful suspend | 56 // Called when a suspend finishes. This is either a successful suspend |
57 // followed by a resume, or a suspend that was canceled. Inherited from | 57 // followed by a resume, or a suspend that was canceled. Inherited from |
58 // PowerManagerClient::Observer. | 58 // PowerManagerClient::Observer. |
59 virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE; | 59 virtual void SuspendDone(const base::TimeDelta& sleep_duration) override; |
60 | 60 |
61 // Turns on perf collection. Resets the timer that's used to schedule | 61 // Turns on perf collection. Resets the timer that's used to schedule |
62 // collections. | 62 // collections. |
63 void OnUserLoggedIn(); | 63 void OnUserLoggedIn(); |
64 | 64 |
65 // Called when a session restore has finished. | 65 // Called when a session restore has finished. |
66 // Inherited from content::NotificationObserver. | 66 // Inherited from content::NotificationObserver. |
67 virtual void Observe(int type, | 67 virtual void Observe(int type, |
68 const content::NotificationSource& source, | 68 const content::NotificationSource& source, |
69 const content::NotificationDetails& details) OVERRIDE; | 69 const content::NotificationDetails& details) override; |
70 | 70 |
71 // Turns off perf collection. Does not delete any data that was already | 71 // Turns off perf collection. Does not delete any data that was already |
72 // collected and stored in |cached_perf_data_|. | 72 // collected and stored in |cached_perf_data_|. |
73 void Deactivate(); | 73 void Deactivate(); |
74 | 74 |
75 // Selects a random time in the upcoming profiling interval that begins at | 75 // Selects a random time in the upcoming profiling interval that begins at |
76 // |next_profiling_interval_start_|. Schedules |timer_| to invoke | 76 // |next_profiling_interval_start_|. Schedules |timer_| to invoke |
77 // DoPeriodicCollection() when that time comes. | 77 // DoPeriodicCollection() when that time comes. |
78 void ScheduleIntervalCollection(); | 78 void ScheduleIntervalCollection(); |
79 | 79 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 // To pass around the "this" pointer across threads safely. | 130 // To pass around the "this" pointer across threads safely. |
131 base::WeakPtrFactory<PerfProvider> weak_factory_; | 131 base::WeakPtrFactory<PerfProvider> weak_factory_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(PerfProvider); | 133 DISALLOW_COPY_AND_ASSIGN(PerfProvider); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace metrics | 136 } // namespace metrics |
137 | 137 |
138 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ | 138 #endif // CHROME_BROWSER_METRICS_PERF_PROVIDER_CHROMEOS_H_ |
OLD | NEW |