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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 2539263003: Move Task Scheduler Initialization From chrome/browser to Content (Closed)
Patch Set: 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: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index a9aaea8c7d26e8797aedf057dbfe6840c3fa8128..53ab0687c8ef5622340dae2455744bf0cb7ed342 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -33,7 +33,6 @@
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/sys_info.h"
-#include "base/task_scheduler/task_scheduler.h"
#include "base/threading/platform_thread.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
@@ -135,7 +134,6 @@
#include "components/rappor/rappor_service.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
-#include "components/task_scheduler_util/initialization_util.h"
#include "components/tracing/common/tracing_switches.h"
#include "components/translate/core/browser/translate_download_manager.h"
#include "components/variations/field_trial_config/field_trial_util.h"
@@ -1201,24 +1199,15 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
// IMPORTANT
gab 2016/11/30 22:36:58 Does this comment apply anymore? i.e. it's relevan
robliao 2016/12/06 01:31:30 Moved to top and reworded.
// Do not add anything below this line until you've verified your new code
- // does not interfere with the critical initialization order below. Some of
- // the calls below end up implicitly creating threads and as such new calls
- // typically either belong before them or in a later startup phase.
+ // does not interfere with the critical initialization order below. Calls
+ // after this line should not post tasks or create threads. This work should
+ // be deferred to PreMainMessageLoopRunImpl.
// Now that the command line has been mutated based on about:flags, we can
// initialize field trials and setup metrics. The field trials are needed by
gab 2016/11/30 22:36:58 No longer sets up metrics
robliao 2016/12/06 01:31:30 Reworded. The only implication here is that we can
// IOThread's initialization which happens in BrowserProcess:PreCreateThreads.
SetupFieldTrials();
- // Task Scheduler initialization needs to be here for the following reasons:
- // * After |SetupFieldTrials()|: Initialization uses variations.
- // * Near the end of |PreCreateThreads()|: The TaskScheduler needs to be
- // created before any other threads are (by contract) but it creates
- // 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();
-
// ChromeOS needs ResourceBundle::InitSharedInstance to be called before this.
// This also instantiates the IOThread which requests the metrics service and
// must be after |SetupMetrics()|.
@@ -2070,13 +2059,6 @@ void ChromeBrowserMainParts::PostDestroyThreads() {
// release it.
ignore_result(browser_process_.release());
- // The TaskScheduler was initialized before invoking
- // |browser_process_->PreCreateThreads()|. To maintain scoping symmetry,
- // perform the shutdown after |browser_process_->PostDestroyThreads()|.
- base::TaskScheduler* task_scheduler = base::TaskScheduler::GetInstance();
- if (task_scheduler)
- task_scheduler->Shutdown();
-
browser_shutdown::ShutdownPostThreadsStop(restart_flags);
master_prefs_.reset();
process_singleton_.reset();
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.h » ('j') | chrome/browser/chrome_content_browser_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698