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

Side by Side 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: Rebase. Address feedback. 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/raster_worker_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/threading/platform_thread.h" 5 #include "base/threading/platform_thread.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sched.h> 8 #include <sched.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 11 matching lines...) Expand all
22 22
23 #if defined(OS_LINUX) 23 #if defined(OS_LINUX)
24 #include <sys/prctl.h> 24 #include <sys/prctl.h>
25 #include <sys/resource.h> 25 #include <sys/resource.h>
26 #include <sys/syscall.h> 26 #include <sys/syscall.h>
27 #include <sys/time.h> 27 #include <sys/time.h>
28 #include <unistd.h> 28 #include <unistd.h>
29 #endif 29 #endif
30 30
31 #if defined(OS_ANDROID) 31 #if defined(OS_ANDROID)
32 #include <sys/resource.h>
32 #include "base/android/jni_android.h" 33 #include "base/android/jni_android.h"
33 #endif 34 #endif
34 35
35 // TODO(bbudge) Use time.h when NaCl toolchain supports _POSIX_TIMERS 36 // TODO(bbudge) Use time.h when NaCl toolchain supports _POSIX_TIMERS
36 #if defined(OS_NACL) 37 #if defined(OS_NACL)
37 #include <sys/nacl_syscalls.h> 38 #include <sys/nacl_syscalls.h>
38 #endif 39 #endif
39 40
40 namespace base { 41 namespace base {
41 42
42 #if defined(OS_MACOSX) 43 #if defined(OS_MACOSX)
43 void InitThreading(); 44 void InitThreading();
44 #endif 45 #endif
45 46
46 namespace { 47 namespace {
47 48
48 #if !defined(OS_MACOSX) 49 #if !defined(OS_MACOSX)
49 // Mac name code is in in platform_thread_mac.mm. 50 // Mac name code is in in platform_thread_mac.mm.
50 LazyInstance<ThreadLocalPointer<char> >::Leaky 51 LazyInstance<ThreadLocalPointer<char> >::Leaky
51 current_thread_name = LAZY_INSTANCE_INITIALIZER; 52 current_thread_name = LAZY_INSTANCE_INITIALIZER;
52 #endif 53 #endif
53 54
54 struct ThreadParams { 55 struct ThreadParams {
55 PlatformThread::Delegate* delegate; 56 PlatformThread::Delegate* delegate;
56 bool joinable; 57 bool joinable;
57 }; 58 };
58 59
59 void* ThreadFunc(void* params) { 60 void* ThreadFunc(void* params) {
61 #if defined(OS_ANDROID)
62 // Threads on linux/android may inherit their priority from the thread
63 // where they were created. This sets all threads to the default.
64 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), 0);
jar (doing other things) 2013/01/23 02:37:37 nit: how about checking the return value, at least
65 #endif
60 ThreadParams* thread_params = static_cast<ThreadParams*>(params); 66 ThreadParams* thread_params = static_cast<ThreadParams*>(params);
61 PlatformThread::Delegate* delegate = thread_params->delegate; 67 PlatformThread::Delegate* delegate = thread_params->delegate;
62 if (!thread_params->joinable) 68 if (!thread_params->joinable)
63 base::ThreadRestrictions::SetSingletonAllowed(false); 69 base::ThreadRestrictions::SetSingletonAllowed(false);
64 delete thread_params; 70 delete thread_params;
65 delegate->ThreadMain(); 71 delegate->ThreadMain();
66 #if defined(OS_ANDROID) 72 #if defined(OS_ANDROID)
67 base::android::DetachFromVM(); 73 base::android::DetachFromVM();
68 #endif 74 #endif
69 return NULL; 75 return NULL;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 #if !defined(OS_MACOSX) 283 #if !defined(OS_MACOSX)
278 // Mac OS X uses lower-level mach APIs. 284 // Mac OS X uses lower-level mach APIs.
279 285
280 // static 286 // static
281 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) { 287 void PlatformThread::SetThreadPriority(PlatformThreadHandle, ThreadPriority) {
282 // TODO(crogers): Implement, see http://crbug.com/116172 288 // TODO(crogers): Implement, see http://crbug.com/116172
283 } 289 }
284 #endif 290 #endif
285 291
286 } // namespace base 292 } // namespace base
OLDNEW
« 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