security/sandbox/chromium/base/threading/platform_thread_internal_posix.h
author Bob Owen <bobowencode@gmail.com>
Tue, 06 Sep 2016 08:57:21 +0100
changeset 312802 a46f0e32289bb8975eef7f87d14cbd71c9c10582
child 349278 d9872fdd25f8529697f75c6a7ef88d18dc7b5f80
permissions -rw-r--r--
Bug 1287426 Part 3: Update security/sandbox/chromium/ to commit 4ec79b7f2379a60cdc15599e93255c0fa417f1ed. r=aklotz, r=jld MozReview-Commit-ID: 14eHMsYZznA

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_
#define BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_

#include "base/threading/platform_thread.h"

namespace base {

namespace internal {

struct ThreadPriorityToNiceValuePair {
  ThreadPriority priority;
  int nice_value;
};
extern const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4];

// Returns the nice value matching |priority| based on the platform-specific
// implementation of kThreadPriorityToNiceValueMap.
int ThreadPriorityToNiceValue(ThreadPriority priority);

// Returns the ThreadPrioirty matching |nice_value| based on the platform-
// specific implementation of kThreadPriorityToNiceValueMap.
ThreadPriority NiceValueToThreadPriority(int nice_value);

// Allows platform specific tweaks to the generic POSIX solution for
// SetCurrentThreadPriority. Returns true if the platform-specific
// implementation handled this |priority| change, false if the generic
// implementation should instead proceed.
bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority);

// Returns true if there is a platform-specific ThreadPriority set on the
// current thread (and returns the actual ThreadPriority via |priority|).
// Returns false otherwise, leaving |priority| untouched.
bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority);

}  // namespace internal

}  // namespace base

#endif  // BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_