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

Unified Diff: components/task_scheduler_util/initialization/browser_util.cc

Issue 2539263003: Move Task Scheduler Initialization From chrome/browser to Content (Closed)
Patch Set: Rebase to bf8e2f1 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/initialization/browser_util.cc
diff --git a/components/task_scheduler_util/initialization/browser_util.cc b/components/task_scheduler_util/initialization/browser_util.cc
index a468281718b14b8f7b2e7a15d13e2d3a450c4936..ff9bbf92ce5d139169bf975b8d4833cb162f8d1e 100644
--- a/components/task_scheduler_util/initialization/browser_util.cc
+++ b/components/task_scheduler_util/initialization/browser_util.cc
@@ -11,7 +11,6 @@
#include "base/task_scheduler/switches.h"
#include "base/task_scheduler/task_traits.h"
#include "base/threading/sequenced_worker_pool.h"
-#include "build/build_config.h"
namespace task_scheduler_util {
namespace initialization {
@@ -85,6 +84,7 @@ size_t BrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits) {
return is_background ? BACKGROUND : FOREGROUND;
}
+#if defined(OS_IOS)
std::vector<base::SchedulerWorkerPoolParams>
GetDefaultBrowserSchedulerWorkerPoolParams() {
constexpr size_t kNumWorkerPoolsDefined =
@@ -93,7 +93,12 @@ GetDefaultBrowserSchedulerWorkerPoolParams() {
static_assert(kNumWorkerPoolsDefined == 4,
"Expected 4 worker pools in BrowserWorkerPoolsConfiguration");
BrowserWorkerPoolsConfiguration config;
-#if defined(OS_ANDROID) || defined(OS_IOS)
+ constexpr size_t kSizeAssignedFields =
+ sizeof(config.background.threads) +
+ sizeof(config.background.detach_period) +
+ sizeof(config.background.standby_thread_policy);
+ static_assert(kSizeAssignedFields == sizeof(config.background),
+ "Not all fields were assigned");
config.background.standby_thread_policy = StandbyThreadPolicy::ONE;
config.background.threads =
base::RecommendedMaxNumberOfThreadsInPool(2, 8, 0.1, 0);
@@ -113,29 +118,9 @@ GetDefaultBrowserSchedulerWorkerPoolParams() {
config.foreground_file_io.threads =
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.3, 0);
config.foreground_file_io.detach_period = base::TimeDelta::FromSeconds(30);
-#else
- config.background.standby_thread_policy = StandbyThreadPolicy::ONE;
- config.background.threads =
- base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0);
- config.background.detach_period = base::TimeDelta::FromSeconds(30);
-
- config.background_file_io.standby_thread_policy = StandbyThreadPolicy::ONE;
- config.background_file_io.threads =
- base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0);
- config.background_file_io.detach_period = base::TimeDelta::FromSeconds(30);
-
- config.foreground.standby_thread_policy = StandbyThreadPolicy::ONE;
- config.foreground.threads =
- base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0);
- config.foreground.detach_period = base::TimeDelta::FromSeconds(30);
-
- config.foreground_file_io.standby_thread_policy = StandbyThreadPolicy::ONE;
- config.foreground_file_io.threads =
- base::RecommendedMaxNumberOfThreadsInPool(8, 32, 0.3, 0);
- config.foreground_file_io.detach_period = base::TimeDelta::FromSeconds(30);
-#endif
return BrowserWorkerPoolConfigurationToSchedulerWorkerPoolParams(config);
}
+#endif // defined(OS_IOS)
} // namespace initialization
} // namespace task_scheduler_util
« no previous file with comments | « components/task_scheduler_util/initialization/browser_util.h ('k') | components/task_scheduler_util/initialization_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698