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

Side by Side Diff: base/threading/platform_thread_posix.cc

Issue 1830693004: content: Depict priority in raster worker thread's name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <pthread.h> 8 #include <pthread.h>
9 #include <sched.h> 9 #include <sched.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 *thread_handle = PlatformThreadHandle(handle); 118 *thread_handle = PlatformThreadHandle(handle);
119 119
120 pthread_attr_destroy(&attributes); 120 pthread_attr_destroy(&attributes);
121 121
122 return success; 122 return success;
123 } 123 }
124 124
125 } // namespace 125 } // namespace
126 126
127 // TODO(prashant.n): Move to common file across platforms.
128 std::string GetThreadPriorityAbbr(ThreadPriority priority) {
129 switch (priority) {
130 case ThreadPriority::BACKGROUND:
131 return "bg";
132 case ThreadPriority::NORMAL:
133 return "nl";
134 case ThreadPriority::DISPLAY:
135 return "ds";
136 case ThreadPriority::REALTIME_AUDIO:
137 return "rt";
138 default:
139 NOTREACHED();
140 return "";
141 }
142 }
143
127 // static 144 // static
128 PlatformThreadId PlatformThread::CurrentId() { 145 PlatformThreadId PlatformThread::CurrentId() {
129 // Pthreads doesn't have the concept of a thread ID, so we have to reach down 146 // Pthreads doesn't have the concept of a thread ID, so we have to reach down
130 // into the kernel. 147 // into the kernel.
131 #if defined(OS_MACOSX) 148 #if defined(OS_MACOSX)
132 return pthread_mach_thread_np(pthread_self()); 149 return pthread_mach_thread_np(pthread_self());
133 #elif defined(OS_LINUX) 150 #elif defined(OS_LINUX)
134 return syscall(__NR_gettid); 151 return syscall(__NR_gettid);
135 #elif defined(OS_ANDROID) 152 #elif defined(OS_ANDROID)
136 return gettid(); 153 return gettid();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return ThreadPriority::NORMAL; 272 return ThreadPriority::NORMAL;
256 } 273 }
257 274
258 return internal::NiceValueToThreadPriority(nice_value); 275 return internal::NiceValueToThreadPriority(nice_value);
259 #endif // !defined(OS_NACL) 276 #endif // !defined(OS_NACL)
260 } 277 }
261 278
262 #endif // !defined(OS_MACOSX) 279 #endif // !defined(OS_MACOSX)
263 280
264 } // namespace base 281 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698