Chromium Code Reviews| 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" | |
| 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/tracing/browser/trace_config_file.h" | 41 #include "components/tracing/browser/trace_config_file.h" |
| 41 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 42 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
| 42 #include "components/tracing/common/trace_to_console.h" | 43 #include "components/tracing/common/trace_to_console.h" |
| 43 #include "components/tracing/common/tracing_switches.h" | 44 #include "components/tracing/common/tracing_switches.h" |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 727 base::kNullProcessId); | 728 base::kNullProcessId); |
| 728 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 729 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 729 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); | 730 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); |
| 730 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 731 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 731 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); | 732 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); |
| 732 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 733 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 733 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); | 734 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); |
| 734 } | 735 } |
| 735 | 736 |
| 736 int BrowserMainLoop::PreCreateThreads() { | 737 int BrowserMainLoop::PreCreateThreads() { |
| 738 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
| |
| 739 | |
| 737 if (parts_) { | 740 if (parts_) { |
| 738 TRACE_EVENT0("startup", | 741 TRACE_EVENT0("startup", |
| 739 "BrowserMainLoop::CreateThreads:PreCreateThreads"); | 742 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
| 740 | 743 |
| 741 result_code_ = parts_->PreCreateThreads(); | 744 result_code_ = parts_->PreCreateThreads(); |
| 742 } | 745 } |
| 743 | 746 |
| 747 // Enable SequencedWorkerPool for this process if it has not already been | |
| 748 // enabled by the BrowserMainParts::PreCreateThreads() call above. | |
| 749 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler | |
| 750 // redirection experiment concludes https://crbug.com/622400. | |
| 751 if (!base::SequencedWorkerPool::IsEnabled()) | |
| 752 base::SequencedWorkerPool::EnableForProcess(); | |
| 753 | |
| 744 const base::CommandLine* command_line = | 754 const base::CommandLine* command_line = |
| 745 base::CommandLine::ForCurrentProcess(); | 755 base::CommandLine::ForCurrentProcess(); |
| 746 // Note that we do not initialize a new FeatureList when calling this for | 756 // Note that we do not initialize a new FeatureList when calling this for |
| 747 // the second time. | 757 // the second time. |
| 748 base::FeatureList::InitializeInstance( | 758 base::FeatureList::InitializeInstance( |
| 749 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | 759 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
| 750 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | 760 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
| 751 | 761 |
| 752 InitializeMemoryManagementComponent(); | 762 InitializeMemoryManagementComponent(); |
| 753 | 763 |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1592 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1602 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1593 audio_thread_->task_runner(); | 1603 audio_thread_->task_runner(); |
| 1594 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1604 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1595 std::move(worker_task_runner), | 1605 std::move(worker_task_runner), |
| 1596 MediaInternals::GetInstance()); | 1606 MediaInternals::GetInstance()); |
| 1597 } | 1607 } |
| 1598 CHECK(audio_manager_); | 1608 CHECK(audio_manager_); |
| 1599 } | 1609 } |
| 1600 | 1610 |
| 1601 } // namespace content | 1611 } // namespace content |
| OLD | NEW |