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

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: Created 6 years, 4 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
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/threading/platform_thread.h"
10 11
11 namespace base { 12 namespace base {
12 13
13 class BASE_EXPORT PowerObserver { 14 class BASE_EXPORT PowerObserver {
15 friend class PowerMonitor;
16
14 public: 17 public:
18 PowerObserver()
19 : power_monitor_thread_(0)
20 {
21 }
22
15 // Notification of a change in power status of the computer, such 23 // Notification of a change in power status of the computer, such
16 // as from switching between battery and A/C power. 24 // as from switching between battery and A/C power.
17 virtual void OnPowerStateChange(bool on_battery_power) {}; 25 virtual void OnPowerStateChange(bool on_battery_power) {}
18 26
19 // Notification that the system is suspending. 27 // Notification that the system is suspending.
20 virtual void OnSuspend() {} 28 virtual void OnSuspend() {}
21 29
22 // Notification that the system is resuming. 30 // Notification that the system is resuming.
23 virtual void OnResume() {} 31 virtual void OnResume() {}
24 32
25 protected: 33 protected:
26 virtual ~PowerObserver() {} 34 virtual ~PowerObserver() {}
35
36 PlatformThreadId power_monitor_thread_;
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
« base/power_monitor/power_monitor.cc ('K') | « base/power_monitor/power_monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698