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

Unified Diff: ios/chrome/browser/ios_chrome_main_parts.mm

Issue 2521653002: [M56] Revert "Enable Initialization of the Task Scheduler by Default in the Browser Process" (Closed)
Patch Set: Created 4 years, 1 month 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 | « ios/chrome/app/strings/ios_strings.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ios_chrome_main_parts.mm
diff --git a/ios/chrome/browser/ios_chrome_main_parts.mm b/ios/chrome/browser/ios_chrome_main_parts.mm
index d80cd693e64aeda170aad56704d3c5d47f434f6d..1363f9f566eb66449274570a5b890df084c74fa1 100644
--- a/ios/chrome/browser/ios_chrome_main_parts.mm
+++ b/ios/chrome/browser/ios_chrome_main_parts.mm
@@ -11,6 +11,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/user_metrics.h"
#include "base/path_service.h"
+#include "base/task_scheduler/switches.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/time/default_tick_clock.h"
#include "components/content_settings/core/browser/cookie_settings.h"
@@ -59,6 +60,43 @@
#include "ios/chrome/browser/rlz/rlz_tracker_delegate_impl.h" // nogncheck
#endif
+namespace {
+
+void MaybeInitializeTaskScheduler() {
+ static constexpr char kFieldTrialName[] = "BrowserScheduler";
+ std::map<std::string, std::string> variation_params;
+ bool used_default_config = false;
+ if (!variations::GetVariationParams(kFieldTrialName, &variation_params)) {
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserTaskScheduler)) {
+ return;
+ }
+
+ // TODO(robliao): Remove below once iOS uses fieldtrial_testing_config.json.
+ // Synchronize the below from fieldtrial_testing_config.json.
+ DCHECK(variation_params.empty());
+ variation_params["Background"] = "3;8;0.1;0;30000";
+ variation_params["BackgroundFileIO"] = "3;8;0.1;0;30000";
+ variation_params["Foreground"] = "8;32;0.3;0;30000";
+ variation_params["ForegroundFileIO"] = "8;32;0.3;0;30000";
+ used_default_config = true;
+ }
+
+ if (!task_scheduler_util::InitializeDefaultTaskScheduler(variation_params))
+ return;
+
+ // TODO(gab): Remove this when http://crbug.com/622400 concludes.
+ const auto sequenced_worker_pool_param =
+ variation_params.find("RedirectSequencedWorkerPools");
+ if (used_default_config ||
+ (sequenced_worker_pool_param != variation_params.end() &&
+ sequenced_worker_pool_param->second == "true")) {
+ base::SequencedWorkerPool::RedirectToTaskSchedulerForProcess();
+ }
+}
+
+} // namespace
+
IOSChromeMainParts::IOSChromeMainParts(
const base::CommandLine& parsed_command_line)
: parsed_command_line_(parsed_command_line), local_state_(nullptr) {
@@ -134,7 +172,7 @@ void IOSChromeMainParts::PreCreateThreads() {
// threads itself so instantiating it earlier is also incorrect.
// To maintain scoping symmetry, if this line is moved, the corresponding
// shutdown call may also need to be moved.
- task_scheduler_util::InitializeDefaultBrowserTaskScheduler();
+ MaybeInitializeTaskScheduler();
SetupMetrics();
« no previous file with comments | « ios/chrome/app/strings/ios_strings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698