Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: base/power_monitor/power_observer.h

Issue 502003003: Check to ensure PowerObservers are added and removed on the same thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/power_monitor/power_monitor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 BASE_POWER_MONITOR_POWER_OBSERVER_H_ 5 #ifndef BASE_POWER_MONITOR_POWER_OBSERVER_H_
6 #define BASE_POWER_MONITOR_POWER_OBSERVER_H_ 6 #define BASE_POWER_MONITOR_POWER_OBSERVER_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread_checker.h"
10 12
11 namespace base { 13 namespace base {
12 14
13 class BASE_EXPORT PowerObserver { 15 class BASE_EXPORT PowerObserver {
16 friend class PowerMonitor;
17
14 public: 18 public:
15 // Notification of a change in power status of the computer, such 19 // Notification of a change in power status of the computer, such
16 // as from switching between battery and A/C power. 20 // as from switching between battery and A/C power.
17 virtual void OnPowerStateChange(bool on_battery_power) {}; 21 virtual void OnPowerStateChange(bool on_battery_power) {}
18 22
19 // Notification that the system is suspending. 23 // Notification that the system is suspending.
20 virtual void OnSuspend() {} 24 virtual void OnSuspend() {}
21 25
22 // Notification that the system is resuming. 26 // Notification that the system is resuming.
23 virtual void OnResume() {} 27 virtual void OnResume() {}
24 28
25 protected: 29 protected:
26 virtual ~PowerObserver() {} 30 virtual ~PowerObserver() {}
31
32 private:
33
brettw 2014/08/26 20:25:39 Nit: no blank here.
34 // Allows PowerMonitor to ensure this observer is added and removed
35 // from the same thread, which is required by the ObserverListThreadSafe.
36 scoped_ptr<base::ThreadChecker> power_monitor_thread_checker_;
27 }; 37 };
28 38
29 } // namespace base 39 } // namespace base
30 40
31 #endif // BASE_POWER_MONITOR_POWER_OBSERVER_H_ 41 #endif // BASE_POWER_MONITOR_POWER_OBSERVER_H_
OLDNEW
« no previous file with comments | « base/power_monitor/power_monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698