OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #ifndef BASE_TASK_SCHEDULER_CURRENT_TASK_TRAITS_H_ |
| 6 #define BASE_TASK_SCHEDULER_CURRENT_TASK_TRAITS_H_ |
| 7 |
| 8 #include "base/base_export.h" |
| 9 #include "base/logging.h" |
| 10 #include "base/macros.h" |
| 11 |
| 12 namespace base { |
| 13 |
| 14 class TaskTraits; |
| 15 |
| 16 namespace internal { |
| 17 |
| 18 class BASE_EXPORT ScopedSetTaskTraitsForCurrentThread { |
| 19 public: |
| 20 // Within the scope of this object, GetTaskTraitsForCurrentThread() will |
| 21 // return |traits|. |
| 22 ScopedSetTaskTraitsForCurrentThread(const TaskTraits* traits); |
| 23 ~ScopedSetTaskTraitsForCurrentThread(); |
| 24 |
| 25 private: |
| 26 #if DCHECK_IS_ON() |
| 27 const TaskTraits* const traits_; |
| 28 #endif |
| 29 |
| 30 DISALLOW_COPY_AND_ASSIGN(ScopedSetTaskTraitsForCurrentThread); |
| 31 }; |
| 32 |
| 33 // Returns the TaskTraits of the task running on the current thread. |
| 34 BASE_EXPORT const TaskTraits* GetTaskTraitsForCurrentThread(); |
| 35 |
| 36 } // namespace internal |
| 37 } // namespace base |
| 38 |
| 39 #endif // BASE_TASK_SCHEDULER_CURRENT_TASK_TRAITS_H_ |
OLD | NEW |