Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: base/task_scheduler/task_traits_for_current_thread.h

Issue 2546773002: TaskScheduler: Add internal::GetTaskPriorityForCurrentThread(). (Closed)
Patch Set: self-review Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698