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

Unified Diff: base/threading/platform_thread_posix.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 | « no previous file | cc/raster_worker_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/platform_thread_posix.cc
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 444edc58a6268649115f2f1583bc7b56374d961d..b17c34d43d5ccaf92275616147976156b62b6567 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -29,6 +29,7 @@
#endif
#if defined(OS_ANDROID)
+#include <sys/resource.h>
#include "base/android/jni_android.h"
#endif
@@ -57,6 +58,13 @@ struct ThreadParams {
};
void* ThreadFunc(void* params) {
+#if defined(OS_ANDROID)
+ // Threads on linux/android may inherit their priority from the thread
+ // where they were created. This sets all threads to the default.
+ // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
+ if (setpriority(PRIO_PROCESS, PlatformThread::CurrentId(), 0))
+ DVLOG(1) << "Failed to reset initial thread nice value to zero.";
+#endif
ThreadParams* thread_params = static_cast<ThreadParams*>(params);
PlatformThread::Delegate* delegate = thread_params->delegate;
if (!thread_params->joinable)
« no previous file with comments | « no previous file | cc/raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698