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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 2227343002: Add Browser Task Scheduler Flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust DCHECK message Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 19 matching lines...) Expand all
30 #include "base/path_service.h" 30 #include "base/path_service.h"
31 #include "base/profiler/scoped_tracker.h" 31 #include "base/profiler/scoped_tracker.h"
32 #include "base/run_loop.h" 32 #include "base/run_loop.h"
33 #include "base/strings/string_number_conversions.h" 33 #include "base/strings/string_number_conversions.h"
34 #include "base/strings/string_piece.h" 34 #include "base/strings/string_piece.h"
35 #include "base/strings/string_split.h" 35 #include "base/strings/string_split.h"
36 #include "base/strings/sys_string_conversions.h" 36 #include "base/strings/sys_string_conversions.h"
37 #include "base/strings/utf_string_conversions.h" 37 #include "base/strings/utf_string_conversions.h"
38 #include "base/sys_info.h" 38 #include "base/sys_info.h"
39 #include "base/task_scheduler/scheduler_worker_pool_params.h" 39 #include "base/task_scheduler/scheduler_worker_pool_params.h"
40 #include "base/task_scheduler/switches.h"
40 #include "base/task_scheduler/task_scheduler.h" 41 #include "base/task_scheduler/task_scheduler.h"
41 #include "base/task_scheduler/task_traits.h" 42 #include "base/task_scheduler/task_traits.h"
42 #include "base/threading/platform_thread.h" 43 #include "base/threading/platform_thread.h"
43 #include "base/time/default_tick_clock.h" 44 #include "base/time/default_tick_clock.h"
44 #include "base/time/time.h" 45 #include "base/time/time.h"
45 #include "base/trace_event/trace_event.h" 46 #include "base/trace_event/trace_event.h"
46 #include "base/values.h" 47 #include "base/values.h"
47 #include "build/build_config.h" 48 #include "build/build_config.h"
48 #include "cc/base/switches.h" 49 #include "cc/base/switches.h"
49 #include "chrome/browser/about_flags.h" 50 #include "chrome/browser/about_flags.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 : FOREGROUND_FILE_IO_WORKER_POOL; 388 : FOREGROUND_FILE_IO_WORKER_POOL;
388 } 389 }
389 return is_background ? BACKGROUND_WORKER_POOL : FOREGROUND_WORKER_POOL; 390 return is_background ? BACKGROUND_WORKER_POOL : FOREGROUND_WORKER_POOL;
390 } 391 }
391 392
392 // Initializes the Default Browser Task Scheduler if there is a valid variation 393 // Initializes the Default Browser Task Scheduler if there is a valid variation
393 // parameter for the field trial. 394 // parameter for the field trial.
394 void MaybeInitializeTaskScheduler() { 395 void MaybeInitializeTaskScheduler() {
395 static constexpr char kFieldTrialName[] = "BrowserScheduler"; 396 static constexpr char kFieldTrialName[] = "BrowserScheduler";
396 std::map<std::string, std::string> variation_params; 397 std::map<std::string, std::string> variation_params;
397 if (!variations::GetVariationParams(kFieldTrialName, &variation_params)) 398 if (!variations::GetVariationParams(kFieldTrialName, &variation_params)) {
399 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
400 switches::kEnableBrowserTaskScheduler))
401 << "The Browser Task Scheduler remains disabled with "
402 << switches::kEnableBrowserTaskScheduler
403 << " because there is no available variation param for this build or "
404 " the task scheduler is disabled in chrome://flags.";
398 return; 405 return;
406 }
399 407
400 using ThreadPriority = base::ThreadPriority; 408 using ThreadPriority = base::ThreadPriority;
401 using IORestriction = base::SchedulerWorkerPoolParams::IORestriction; 409 using IORestriction = base::SchedulerWorkerPoolParams::IORestriction;
402 struct SchedulerWorkerPoolPredefinedParams { 410 struct SchedulerWorkerPoolPredefinedParams {
403 const char* name; 411 const char* name;
404 ThreadPriority priority_hint; 412 ThreadPriority priority_hint;
405 IORestriction io_restriction; 413 IORestriction io_restriction;
406 }; 414 };
407 static const SchedulerWorkerPoolPredefinedParams kAllPredefinedParams[] = { 415 static const SchedulerWorkerPoolPredefinedParams kAllPredefinedParams[] = {
408 {"Background", ThreadPriority::BACKGROUND, IORestriction::DISALLOWED}, 416 {"Background", ThreadPriority::BACKGROUND, IORestriction::DISALLOWED},
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 chromeos::CrosSettings::Shutdown(); 2208 chromeos::CrosSettings::Shutdown();
2201 #endif // defined(OS_CHROMEOS) 2209 #endif // defined(OS_CHROMEOS)
2202 #endif // defined(OS_ANDROID) 2210 #endif // defined(OS_ANDROID)
2203 } 2211 }
2204 2212
2205 // Public members: 2213 // Public members:
2206 2214
2207 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 2215 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
2208 chrome_extra_parts_.push_back(parts); 2216 chrome_extra_parts_.push_back(parts);
2209 } 2217 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698