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

Unified Diff: content/child/child_thread_impl.cc

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 | « content/browser/renderer_host/render_process_host_impl.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 29454b64e1ab12feba98ce80e1d88bb66093b504..9bb1486e04317f5f283fa9ccf4665b159b208526 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -777,10 +777,17 @@ bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
}
void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) {
+ LOG(ERROR) << __func__ << " : " << backgrounded;
// Set timer slack to maximum on main thread when in background.
base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
if (backgrounded)
timer_slack = base::TIMER_SLACK_MAXIMUM;
+#if defined(OS_ANDROID)
+ // Defer suspend events on Android if the scheduler says so; this ensures that
+ // functionality like background audio playback works properly.
+ base::PowerMonitor::Get()->DeferSuspendEvents(!backgrounded);
+#endif
+
base::MessageLoop::current()->SetTimerSlack(timer_slack);
}
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698