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

Unified Diff: base/power_monitor/power_monitor.h

Issue 2310343002: Defer suspend events on Android when audio is active. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/power_monitor/power_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/power_monitor/power_monitor.h
diff --git a/base/power_monitor/power_monitor.h b/base/power_monitor/power_monitor.h
index e025b324011b4420750bdbf53744bf04ccab62c9..36991b11efba800f5e1700c2823fc0131b5c9cf0 100644
--- a/base/power_monitor/power_monitor.h
+++ b/base/power_monitor/power_monitor.h
@@ -10,6 +10,11 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list_threadsafe.h"
#include "base/power_monitor/power_observer.h"
+#include "build/build_config.h"
+
+#if defined(OS_ANDROID)
+#include "base/synchronization/lock.h"
+#endif
namespace base {
@@ -35,6 +40,10 @@ class BASE_EXPORT PowerMonitor {
// Is the computer currently on battery power.
bool IsOnBatteryPower();
+#if defined(OS_ANDROID)
+ void DeferSuspendEvents(bool defer);
+#endif
+
private:
friend class PowerMonitorSource;
@@ -47,6 +56,10 @@ class BASE_EXPORT PowerMonitor {
scoped_refptr<ObserverListThreadSafe<PowerObserver> > observers_;
std::unique_ptr<PowerMonitorSource> source_;
+ base::Lock lock_;
+ bool is_suspended_ = false;
+ bool should_defer_suspend_ = false;
+
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};
« no previous file with comments | « no previous file | base/power_monitor/power_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698