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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 2445763002: Disallow posting tasks to SequencedWorkerPools by default. (Closed)
Patch Set: self-review 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 unified diff | Download patch
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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 13 matching lines...) Expand all
24 #include "base/metrics/user_metrics.h" 24 #include "base/metrics/user_metrics.h"
25 #include "base/pending_task.h" 25 #include "base/pending_task.h"
26 #include "base/power_monitor/power_monitor.h" 26 #include "base/power_monitor/power_monitor.h"
27 #include "base/power_monitor/power_monitor_device_source.h" 27 #include "base/power_monitor/power_monitor_device_source.h"
28 #include "base/process/process_metrics.h" 28 #include "base/process/process_metrics.h"
29 #include "base/run_loop.h" 29 #include "base/run_loop.h"
30 #include "base/single_thread_task_runner.h" 30 #include "base/single_thread_task_runner.h"
31 #include "base/strings/string_number_conversions.h" 31 #include "base/strings/string_number_conversions.h"
32 #include "base/strings/string_split.h" 32 #include "base/strings/string_split.h"
33 #include "base/system_monitor/system_monitor.h" 33 #include "base/system_monitor/system_monitor.h"
34 #include "base/threading/sequenced_worker_pool.h"
34 #include "base/threading/thread_restrictions.h" 35 #include "base/threading/thread_restrictions.h"
35 #include "base/threading/thread_task_runner_handle.h" 36 #include "base/threading/thread_task_runner_handle.h"
36 #include "base/timer/hi_res_timer_manager.h" 37 #include "base/timer/hi_res_timer_manager.h"
37 #include "base/trace_event/memory_dump_manager.h" 38 #include "base/trace_event/memory_dump_manager.h"
38 #include "base/trace_event/trace_event.h" 39 #include "base/trace_event/trace_event.h"
39 #include "build/build_config.h" 40 #include "build/build_config.h"
40 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" 41 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h"
41 #include "components/tracing/browser/trace_config_file.h" 42 #include "components/tracing/browser/trace_config_file.h"
42 #include "components/tracing/common/process_metrics_memory_dump_provider.h" 43 #include "components/tracing/common/process_metrics_memory_dump_provider.h"
43 #include "components/tracing/common/trace_to_console.h" 44 #include "components/tracing/common/trace_to_console.h"
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 base::kNullProcessId); 729 base::kNullProcessId);
729 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 730 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
730 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); 731 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr);
731 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 732 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
732 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); 733 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr);
733 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 734 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
734 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); 735 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr);
735 } 736 }
736 737
737 int BrowserMainLoop::PreCreateThreads() { 738 int BrowserMainLoop::PreCreateThreads() {
739 // SequencedWorkerPool shouldn't be enabled yet. It should be enabled below by
740 // either |parts_|->PreCreateThreads() or
741 // base::SequencedWorkerPool::EnableForProcess().
742 // TODO(fdoray): Uncomment this line.
743 // DCHECK(!base::SequencedWorkerPool::IsEnabled());
744
738 if (parts_) { 745 if (parts_) {
739 TRACE_EVENT0("startup", 746 TRACE_EVENT0("startup",
740 "BrowserMainLoop::CreateThreads:PreCreateThreads"); 747 "BrowserMainLoop::CreateThreads:PreCreateThreads");
741 748
742 result_code_ = parts_->PreCreateThreads(); 749 result_code_ = parts_->PreCreateThreads();
743 } 750 }
744 751
752 // Enable SequencedWorkerPool if |parts_|->PreCreateThreads() hasn't enabled
753 // it.
754 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler
755 // redirection experiment concludes https://crbug.com/622400.
756 if (!base::SequencedWorkerPool::IsEnabled())
757 base::SequencedWorkerPool::EnableForProcess();
758
745 const base::CommandLine* command_line = 759 const base::CommandLine* command_line =
746 base::CommandLine::ForCurrentProcess(); 760 base::CommandLine::ForCurrentProcess();
747 // Note that we do not initialize a new FeatureList when calling this for 761 // Note that we do not initialize a new FeatureList when calling this for
748 // the second time. 762 // the second time.
749 base::FeatureList::InitializeInstance( 763 base::FeatureList::InitializeInstance(
750 command_line->GetSwitchValueASCII(switches::kEnableFeatures), 764 command_line->GetSwitchValueASCII(switches::kEnableFeatures),
751 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); 765 command_line->GetSwitchValueASCII(switches::kDisableFeatures));
752 766
753 InitializeMemoryManagementComponent(); 767 InitializeMemoryManagementComponent();
754 768
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = 1620 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner =
1607 audio_thread_->task_runner(); 1621 audio_thread_->task_runner();
1608 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), 1622 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner),
1609 std::move(worker_task_runner), 1623 std::move(worker_task_runner),
1610 MediaInternals::GetInstance()); 1624 MediaInternals::GetInstance());
1611 } 1625 }
1612 CHECK(audio_manager_); 1626 CHECK(audio_manager_);
1613 } 1627 }
1614 1628
1615 } // namespace content 1629 } // namespace content
OLDNEW
« no previous file with comments | « components/task_scheduler_util/initialization_util.cc ('k') | content/public/test/browser_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698