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

Unified Diff: content/common/child_process.cc

Issue 11880014: cc: Set ui/gpu/cc/ipc/upload/raster thread priorities. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address feedback (use static). Created 7 years, 11 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/browser_main_loop.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/child_process.cc
diff --git a/content/common/child_process.cc b/content/common/child_process.cc
index f0dfdc5db41736bcf83c05e2650c5a9c7d3b40d1..6e5d9a45d5f6ae4e6dd58e86d34793c93b862079 100644
--- a/content/common/child_process.cc
+++ b/content/common/child_process.cc
@@ -18,6 +18,8 @@
#if defined(OS_ANDROID)
#include "base/debug/debugger.h"
+// TODO(epenner): Move thread priorities to base. (crbug.com/170549)
+#include <sys/resource.h>
#endif
#if defined(OS_POSIX) && !defined(OS_ANDROID)
@@ -28,6 +30,16 @@ namespace content {
ChildProcess* ChildProcess::child_process_;
+#if defined(OS_ANDROID)
+// TODO(epenner): Move thread priorities to base. (crbug.com/170549)
+namespace {
+void SetHighThreadPriority() {
+ int nice_value = -6; // High priority.
+ setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value);
+}
+}
+#endif
+
ChildProcess::ChildProcess()
: ref_count_(0),
shutdown_event_(true, false),
@@ -40,6 +52,12 @@ ChildProcess::ChildProcess()
// We can't recover from failing to start the IO thread.
CHECK(io_thread_.StartWithOptions(
base::Thread::Options(MessageLoop::TYPE_IO, 0)));
+
+#if defined(OS_ANDROID)
+ // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
+ io_thread_.message_loop()->PostTask(FROM_HERE,
+ base::Bind(&SetHighThreadPriority));
+#endif
}
ChildProcess::~ChildProcess() {
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698