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

Unified Diff: components/task_scheduler_util/browser/initialization.h

Issue 2565013002: Split browser-specific and generic code in components/task_scheduler_util/. (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: components/task_scheduler_util/browser/initialization.h
diff --git a/components/task_scheduler_util/browser/initialization.h b/components/task_scheduler_util/browser/initialization.h
new file mode 100644
index 0000000000000000000000000000000000000000..74e890f38294d81886b013982f55a32b0489ffae
--- /dev/null
+++ b/components/task_scheduler_util/browser/initialization.h
@@ -0,0 +1,44 @@
+// 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 COMPONENTS_TASK_SCHEDULER_UTIL_BROWSER_INITIALIZATION_H_
+#define COMPONENTS_TASK_SCHEDULER_UTIL_BROWSER_INITIALIZATION_H_
+
+#include <stddef.h>
+
+#include <vector>
+
+#include "build/build_config.h"
+
+namespace base {
+class SchedulerWorkerPoolParams;
+class TaskTraits;
+}
+
+namespace task_scheduler_util {
+
+// Gets a vector of SchedulerWorkerPoolParams to initialize TaskScheduler in the
+// browser based off variations. Returns an empty vector on failure.
+std::vector<base::SchedulerWorkerPoolParams>
+GetBrowserWorkerPoolParamsFromVariations();
+
+#if defined(OS_IOS)
+// Gets a vector of SchedulerWorkerPoolParams to initialize TaskScheduler in the
+// browser based off default variation params.
+std::vector<base::SchedulerWorkerPoolParams>
+GetDefaultBrowserWorkerPoolParams();
robliao 2016/12/15 21:26:46 This is no longer required with the committed iOS
fdoray 2016/12/15 21:48:49 Done.
+#endif
+
+// Maps |traits| to the index of a browser worker pool vector provided by
+// GetBrowserWorkerPoolParamsFromVariations() or
+// GetDefaultBrowserWorkerPoolParams().
+size_t BrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits);
+
+// Redirects zero-to-many PostTask APIs to the browser task scheduler based off
+// variations.
+void MaybePerformBrowserTaskSchedulerRedirection();
+
+} // namespace task_scheduler_util
+
+#endif // COMPONENTS_TASK_SCHEDULER_UTIL_BROWSER_INITIALIZATION_H_

Powered by Google App Engine
This is Rietveld 408576698