Chromium Code Reviews| Index: base/task_scheduler/task_priority_for_current_thread.h |
| diff --git a/base/task_scheduler/task_priority_for_current_thread.h b/base/task_scheduler/task_priority_for_current_thread.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8eb728f458682ff15aa6d810c7274e506d877b4b |
| --- /dev/null |
| +++ b/base/task_scheduler/task_priority_for_current_thread.h |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2016 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_TASK_SCHEDULER_TASK_PRIORITY_FOR_CURRENT_THREAD_H_ |
| +#define BASE_TASK_SCHEDULER_TASK_PRIORITY_FOR_CURRENT_THREAD_H_ |
| + |
| +#include "base/base_export.h" |
| +#include "base/macros.h" |
| +#include "base/task_scheduler/task_traits.h" |
| + |
| +namespace base { |
| +namespace internal { |
| + |
| +class BASE_EXPORT ScopedSetTaskPriorityForCurrentThread { |
|
robliao
2016/12/01 19:27:27
The file name should match the class. scoped_set_t
fdoray
2016/12/01 19:41:07
Even if this file also declares a GetTaskPriorityF
robliao
2016/12/01 20:08:57
That's the convention we've used so far. It goes w
fdoray
2016/12/01 20:23:36
Done.
|
| + public: |
| + // Within the scope of this object, GetTaskPriorityForCurrentThread() will |
| + // return |priority|. |
| + ScopedSetTaskPriorityForCurrentThread(TaskPriority priority); |
| + ~ScopedSetTaskPriorityForCurrentThread(); |
| + |
| + private: |
| + const TaskPriority priority_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ScopedSetTaskPriorityForCurrentThread); |
| +}; |
| + |
| +// Returns the priority of the TaskScheduler task running on the current thread, |
| +// or TaskPriority::USER_VISIBLE if no TaskScheduler task is running on the |
| +// current thread. |
| +BASE_EXPORT TaskPriority GetTaskPriorityForCurrentThread(); |
| + |
| +} // namespace internal |
| +} // namespace base |
| + |
| +#endif // BASE_TASK_SCHEDULER_TASK_PRIORITY_FOR_CURRENT_THREAD_H_ |