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

Unified Diff: content/browser/browser_main_loop.cc

Issue 2445763002: Disallow posting tasks to SequencedWorkerPools by default. (Closed)
Patch Set: CR gab #57 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
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index b652408781292dcabc393cb8919471f25ea4acb3..c1b9e7d67409fbbbf2135c18e69a917797166d9b 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -31,6 +31,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/system_monitor/system_monitor.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/timer/hi_res_timer_manager.h"
@@ -734,6 +735,8 @@ void BrowserMainLoop::PostMainMessageLoopStart() {
}
int BrowserMainLoop::PreCreateThreads() {
+ DCHECK(!base::SequencedWorkerPool::IsEnabled());
gab 2016/11/01 21:48:02 DCHECK are supposed to document invariants, so a D
fdoray 2016/11/02 12:56:09 Added comment to clarify. SequencedWorkerPool is
+
if (parts_) {
TRACE_EVENT0("startup",
"BrowserMainLoop::CreateThreads:PreCreateThreads");
@@ -741,6 +744,13 @@ int BrowserMainLoop::PreCreateThreads() {
result_code_ = parts_->PreCreateThreads();
}
+ // Enable SequencedWorkerPool for this process if it has not already been
+ // enabled by the BrowserMainParts::PreCreateThreads() call above.
+ // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler
+ // redirection experiment concludes https://crbug.com/622400.
+ if (!base::SequencedWorkerPool::IsEnabled())
+ base::SequencedWorkerPool::EnableForProcess();
+
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// Note that we do not initialize a new FeatureList when calling this for

Powered by Google App Engine
This is Rietveld 408576698