Roll src/third_party/WebKit 7764cd0:1eb8b9f (svn 199730:199735)
[chromium-blink-merge.git] / base / threading / platform_thread_internal_posix.cc
blob9af02044fceed2635b4fc5bf1ee5e1a06927a6fe
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/threading/platform_thread_internal_posix.h"
7 #include "base/logging.h"
9 namespace base {
11 namespace internal {
13 int ThreadPriorityToNiceValue(ThreadPriority priority) {
14 for (const ThreadPriorityToNiceValuePair& pair :
15 kThreadPriorityToNiceValueMap) {
16 if (pair.priority == priority)
17 return pair.nice_value;
19 NOTREACHED() << "Unknown ThreadPriority";
20 return 0;
23 ThreadPriority NiceValueToThreadPriority(int nice_value) {
24 for (const ThreadPriorityToNiceValuePair& pair :
25 kThreadPriorityToNiceValueMap) {
26 if (pair.nice_value == nice_value)
27 return pair.priority;
29 NOTREACHED() << "Unknown nice value";
30 return ThreadPriority::NORMAL;
33 } // namespace internal
35 } // namespace base