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 <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 const base::CommandLine* command_line = | 810 const base::CommandLine* command_line = |
811 base::CommandLine::ForCurrentProcess(); | 811 base::CommandLine::ForCurrentProcess(); |
812 // Note that we do not initialize a new FeatureList when calling this for | 812 // Note that we do not initialize a new FeatureList when calling this for |
813 // the second time. | 813 // the second time. |
814 base::FeatureList::InitializeInstance( | 814 base::FeatureList::InitializeInstance( |
815 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | 815 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
816 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | 816 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
817 | 817 |
818 InitializeMemoryManagementComponent(); | 818 InitializeMemoryManagementComponent(); |
819 | 819 |
820 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) | |
821 MemoryCoordinatorImpl::GetInstance()->Start(); | |
822 | |
823 #if defined(OS_MACOSX) | 820 #if defined(OS_MACOSX) |
824 if (base::CommandLine::InitializedForCurrentProcess() && | 821 if (base::CommandLine::InitializedForCurrentProcess() && |
825 base::CommandLine::ForCurrentProcess()->HasSwitch( | 822 base::CommandLine::ForCurrentProcess()->HasSwitch( |
826 switches::kEnableHeapProfiling)) { | 823 switches::kEnableHeapProfiling)) { |
827 base::allocator::PeriodicallyShimNewMallocZones(); | 824 base::allocator::PeriodicallyShimNewMallocZones(); |
828 } | 825 } |
829 #endif | 826 #endif |
830 | 827 |
831 #if BUILDFLAG(ENABLE_PLUGINS) | 828 #if BUILDFLAG(ENABLE_PLUGINS) |
832 // Prior to any processing happening on the IO thread, we create the | 829 // Prior to any processing happening on the IO thread, we create the |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 chromeos::switches::GetMemoryPressureThresholds()); | 1594 chromeos::switches::GetMemoryPressureThresholds()); |
1598 } | 1595 } |
1599 #elif defined(OS_MACOSX) | 1596 #elif defined(OS_MACOSX) |
1600 memory_pressure_monitor_ = | 1597 memory_pressure_monitor_ = |
1601 base::MakeUnique<base::mac::MemoryPressureMonitor>(); | 1598 base::MakeUnique<base::mac::MemoryPressureMonitor>(); |
1602 #elif defined(OS_WIN) | 1599 #elif defined(OS_WIN) |
1603 memory_pressure_monitor_ = | 1600 memory_pressure_monitor_ = |
1604 CreateWinMemoryPressureMonitor(parsed_command_line_); | 1601 CreateWinMemoryPressureMonitor(parsed_command_line_); |
1605 #endif | 1602 #endif |
1606 | 1603 |
1607 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 1604 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) |
1608 // Disable MemoryPressureListener when memory coordinator is enabled. | 1605 MemoryCoordinatorImpl::GetInstance()->Start(); |
1609 base::MemoryPressureListener::SetNotificationsSuppressed(true); | |
1610 auto* coordinator = MemoryCoordinatorImpl::GetInstance(); | |
1611 if (memory_pressure_monitor_) { | |
1612 memory_pressure_monitor_->SetDispatchCallback( | |
1613 base::Bind(&MemoryCoordinatorImpl::RecordMemoryPressure, | |
1614 base::Unretained(coordinator))); | |
1615 } | |
1616 } | |
1617 | 1606 |
1618 auto* swap_metrics_observer = SwapMetricsObserver::GetInstance(); | 1607 auto* swap_metrics_observer = SwapMetricsObserver::GetInstance(); |
1619 if (swap_metrics_observer) | 1608 if (swap_metrics_observer) |
1620 swap_metrics_observer->Start(); | 1609 swap_metrics_observer->Start(); |
1621 } | 1610 } |
1622 | 1611 |
1623 bool BrowserMainLoop::InitializeToolkit() { | 1612 bool BrowserMainLoop::InitializeToolkit() { |
1624 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1613 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
1625 | 1614 |
1626 // TODO(evan): this function is rather subtle, due to the variety | 1615 // TODO(evan): this function is rather subtle, due to the variety |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 base::MakeUnique<media::AudioThreadImpl>(), | 1766 base::MakeUnique<media::AudioThreadImpl>(), |
1778 MediaInternals::GetInstance()); | 1767 MediaInternals::GetInstance()); |
1779 } | 1768 } |
1780 CHECK(audio_manager_); | 1769 CHECK(audio_manager_); |
1781 | 1770 |
1782 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1771 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
1783 CHECK(audio_system_); | 1772 CHECK(audio_system_); |
1784 } | 1773 } |
1785 | 1774 |
1786 } // namespace content | 1775 } // namespace content |
OLD | NEW |