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

Unified Diff: base/task_scheduler/environment_config.cc

Issue 2904593002: Refactor Environment Config Out of TaskSchedulerImpl (Closed)
Patch Set: Created 3 years, 7 months 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
« no previous file with comments | « base/task_scheduler/environment_config.h ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/environment_config.cc
diff --git a/base/task_scheduler/environment_config.cc b/base/task_scheduler/environment_config.cc
new file mode 100644
index 0000000000000000000000000000000000000000..393b59161688c1deb9f36e5b667af3992a231ae3
--- /dev/null
+++ b/base/task_scheduler/environment_config.cc
@@ -0,0 +1,19 @@
+// Copyright 2017 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.
+
+#include "base/task_scheduler/environment_config.h"
+
+namespace base {
+namespace internal {
+
+size_t GetEnvironmentIndexForTraits(const TaskTraits& traits) {
+ const bool is_background =
+ traits.priority() == base::TaskPriority::BACKGROUND;
+ if (traits.may_block() || traits.with_base_sync_primitives())
+ return is_background ? BACKGROUND_BLOCKING : FOREGROUND_BLOCKING;
+ return is_background ? BACKGROUND : FOREGROUND;
+}
+
+} // namespace internal
+} // namespace base
« no previous file with comments | « base/task_scheduler/environment_config.h ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698