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

Unified Diff: content/browser/renderer_host/render_process_host_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/media/audio_renderer_host.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 8132d91881c06d0bebedbc1b19d224585844c198..b0dc6a4872528ae75d10cdf972c4eb4a728dcc6e 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -30,6 +30,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/metrics/persistent_histogram_allocator.h"
#include "base/metrics/persistent_memory_allocator.h"
+#include "base/power_monitor/power_monitor.h"
#include "base/process/process_handle.h"
#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
@@ -1438,6 +1439,7 @@ int RenderProcessHostImpl::VisibleWidgetCount() const {
}
void RenderProcessHostImpl::AudioStateChanged() {
+ LOG(ERROR) << __func__;
UpdateProcessPriority();
}
@@ -2752,6 +2754,12 @@ void RenderProcessHostImpl::UpdateProcessPriority() {
// (http://crbug.com/398103).
child_process_launcher_->SetProcessBackgrounded(should_background);
+#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(!should_background);
+#endif
+
// Notify the child process of background state.
Send(new ChildProcessMsg_SetProcessBackgrounded(should_background));
}
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698