| Index: base/task_scheduler/task_traits_for_current_thread.h
|
| diff --git a/base/task_scheduler/task_traits_for_current_thread.h b/base/task_scheduler/task_traits_for_current_thread.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6b8b3f2664e516872fa08c0377948048fbdd812f
|
| --- /dev/null
|
| +++ b/base/task_scheduler/task_traits_for_current_thread.h
|
| @@ -0,0 +1,39 @@
|
| +// 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_CURRENT_TASK_TRAITS_H_
|
| +#define BASE_TASK_SCHEDULER_CURRENT_TASK_TRAITS_H_
|
| +
|
| +#include "base/base_export.h"
|
| +#include "base/logging.h"
|
| +#include "base/macros.h"
|
| +
|
| +namespace base {
|
| +
|
| +class TaskTraits;
|
| +
|
| +namespace internal {
|
| +
|
| +class BASE_EXPORT ScopedSetTaskTraitsForCurrentThread {
|
| + public:
|
| + // Within the scope of this object, GetTaskTraitsForCurrentThread() will
|
| + // return |traits|.
|
| + ScopedSetTaskTraitsForCurrentThread(const TaskTraits* traits);
|
| + ~ScopedSetTaskTraitsForCurrentThread();
|
| +
|
| + private:
|
| +#if DCHECK_IS_ON()
|
| + const TaskTraits* const traits_;
|
| +#endif
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedSetTaskTraitsForCurrentThread);
|
| +};
|
| +
|
| +// Returns the TaskTraits of the task running on the current thread.
|
| +BASE_EXPORT const TaskTraits* GetTaskTraitsForCurrentThread();
|
| +
|
| +} // namespace internal
|
| +} // namespace base
|
| +
|
| +#endif // BASE_TASK_SCHEDULER_CURRENT_TASK_TRAITS_H_
|
|
|