Commit 0b1e1b2f authored by Rintaro Kuroiwa's avatar Rintaro Kuroiwa Committed by Commit Bot

Document PowerMonitor's notification thread

- Because PowerMonitor uses ObserverListThreadSafe, the observers are
  notified on the sequence from which they were registered.

Change-Id: Iea01ec415fca7b9b327a9b1d92ed77008e0cd77c
Reviewed-on: https://chromium-review.googlesource.com/1089584Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Rintaro Kuroiwa <rkuroiwa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565122}
parent 4f20ebb8
...@@ -27,7 +27,8 @@ class BASE_EXPORT PowerMonitor { ...@@ -27,7 +27,8 @@ class BASE_EXPORT PowerMonitor {
static PowerMonitor* Get(); static PowerMonitor* Get();
// Add and remove an observer. // Add and remove an observer.
// Can be called from any thread. // Can be called from any thread. |observer| is notified on the sequence
// from which it was registered.
// Must not be called from within a notification callback. // Must not be called from within a notification callback.
void AddObserver(PowerObserver* observer); void AddObserver(PowerObserver* observer);
void RemoveObserver(PowerObserver* observer); void RemoveObserver(PowerObserver* observer);
...@@ -44,7 +45,7 @@ class BASE_EXPORT PowerMonitor { ...@@ -44,7 +45,7 @@ class BASE_EXPORT PowerMonitor {
void NotifySuspend(); void NotifySuspend();
void NotifyResume(); void NotifyResume();
scoped_refptr<ObserverListThreadSafe<PowerObserver> > observers_; scoped_refptr<ObserverListThreadSafe<PowerObserver>> observers_;
std::unique_ptr<PowerMonitorSource> source_; std::unique_ptr<PowerMonitorSource> source_;
DISALLOW_COPY_AND_ASSIGN(PowerMonitor); DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment