| OLD | NEW |
| 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 Loading... |
| 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" | |
| 35 #include "base/threading/thread_restrictions.h" | 34 #include "base/threading/thread_restrictions.h" |
| 36 #include "base/threading/thread_task_runner_handle.h" | 35 #include "base/threading/thread_task_runner_handle.h" |
| 37 #include "base/timer/hi_res_timer_manager.h" | 36 #include "base/timer/hi_res_timer_manager.h" |
| 38 #include "base/trace_event/memory_dump_manager.h" | 37 #include "base/trace_event/memory_dump_manager.h" |
| 39 #include "base/trace_event/trace_event.h" | 38 #include "base/trace_event/trace_event.h" |
| 40 #include "build/build_config.h" | 39 #include "build/build_config.h" |
| 41 #include "components/discardable_memory/service/discardable_shared_memory_manage
r.h" | 40 #include "components/discardable_memory/service/discardable_shared_memory_manage
r.h" |
| 42 #include "components/tracing/browser/trace_config_file.h" | 41 #include "components/tracing/browser/trace_config_file.h" |
| 43 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 42 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
| 44 #include "components/tracing/common/trace_to_console.h" | 43 #include "components/tracing/common/trace_to_console.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 base::kNullProcessId); | 728 base::kNullProcessId); |
| 730 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 729 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 731 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); | 730 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); |
| 732 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 731 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 733 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); | 732 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); |
| 734 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 733 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 735 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); | 734 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); |
| 736 } | 735 } |
| 737 | 736 |
| 738 int BrowserMainLoop::PreCreateThreads() { | 737 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 DCHECK(!base::SequencedWorkerPool::IsEnabled()); | |
| 743 | |
| 744 if (parts_) { | 738 if (parts_) { |
| 745 TRACE_EVENT0("startup", | 739 TRACE_EVENT0("startup", |
| 746 "BrowserMainLoop::CreateThreads:PreCreateThreads"); | 740 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
| 747 | 741 |
| 748 result_code_ = parts_->PreCreateThreads(); | 742 result_code_ = parts_->PreCreateThreads(); |
| 749 } | 743 } |
| 750 | 744 |
| 751 // Enable SequencedWorkerPool if |parts_|->PreCreateThreads() hasn't enabled | |
| 752 // it. | |
| 753 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler | |
| 754 // redirection experiment concludes https://crbug.com/622400. | |
| 755 if (!base::SequencedWorkerPool::IsEnabled()) | |
| 756 base::SequencedWorkerPool::EnableForProcess(); | |
| 757 | |
| 758 const base::CommandLine* command_line = | 745 const base::CommandLine* command_line = |
| 759 base::CommandLine::ForCurrentProcess(); | 746 base::CommandLine::ForCurrentProcess(); |
| 760 // Note that we do not initialize a new FeatureList when calling this for | 747 // Note that we do not initialize a new FeatureList when calling this for |
| 761 // the second time. | 748 // the second time. |
| 762 base::FeatureList::InitializeInstance( | 749 base::FeatureList::InitializeInstance( |
| 763 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | 750 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
| 764 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | 751 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
| 765 | 752 |
| 766 InitializeMemoryManagementComponent(); | 753 InitializeMemoryManagementComponent(); |
| 767 | 754 |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1606 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1620 audio_thread_->task_runner(); | 1607 audio_thread_->task_runner(); |
| 1621 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1608 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1622 std::move(worker_task_runner), | 1609 std::move(worker_task_runner), |
| 1623 MediaInternals::GetInstance()); | 1610 MediaInternals::GetInstance()); |
| 1624 } | 1611 } |
| 1625 CHECK(audio_manager_); | 1612 CHECK(audio_manager_); |
| 1626 } | 1613 } |
| 1627 | 1614 |
| 1628 } // namespace content | 1615 } // namespace content |
| OLD | NEW |