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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 const base::CommandLine* command_line = | 808 const base::CommandLine* command_line = |
809 base::CommandLine::ForCurrentProcess(); | 809 base::CommandLine::ForCurrentProcess(); |
810 // Note that we do not initialize a new FeatureList when calling this for | 810 // Note that we do not initialize a new FeatureList when calling this for |
811 // the second time. | 811 // the second time. |
812 base::FeatureList::InitializeInstance( | 812 base::FeatureList::InitializeInstance( |
813 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | 813 command_line->GetSwitchValueASCII(switches::kEnableFeatures), |
814 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | 814 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); |
815 | 815 |
816 InitializeMemoryManagementComponent(); | 816 InitializeMemoryManagementComponent(); |
817 | 817 |
818 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) | |
819 MemoryCoordinatorImpl::GetInstance()->Start(); | |
820 | |
821 #if defined(OS_MACOSX) | 818 #if defined(OS_MACOSX) |
822 if (base::CommandLine::InitializedForCurrentProcess() && | 819 if (base::CommandLine::InitializedForCurrentProcess() && |
823 base::CommandLine::ForCurrentProcess()->HasSwitch( | 820 base::CommandLine::ForCurrentProcess()->HasSwitch( |
824 switches::kEnableHeapProfiling)) { | 821 switches::kEnableHeapProfiling)) { |
825 base::allocator::PeriodicallyShimNewMallocZones(); | 822 base::allocator::PeriodicallyShimNewMallocZones(); |
826 } | 823 } |
827 #endif | 824 #endif |
828 | 825 |
829 #if BUILDFLAG(ENABLE_PLUGINS) | 826 #if BUILDFLAG(ENABLE_PLUGINS) |
830 // Prior to any processing happening on the IO thread, we create the | 827 // Prior to any processing happening on the IO thread, we create the |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 chromeos::switches::GetMemoryPressureThresholds()); | 1576 chromeos::switches::GetMemoryPressureThresholds()); |
1580 } | 1577 } |
1581 #elif defined(OS_MACOSX) | 1578 #elif defined(OS_MACOSX) |
1582 memory_pressure_monitor_ = | 1579 memory_pressure_monitor_ = |
1583 base::MakeUnique<base::mac::MemoryPressureMonitor>(); | 1580 base::MakeUnique<base::mac::MemoryPressureMonitor>(); |
1584 #elif defined(OS_WIN) | 1581 #elif defined(OS_WIN) |
1585 memory_pressure_monitor_ = | 1582 memory_pressure_monitor_ = |
1586 CreateWinMemoryPressureMonitor(parsed_command_line_); | 1583 CreateWinMemoryPressureMonitor(parsed_command_line_); |
1587 #endif | 1584 #endif |
1588 | 1585 |
1589 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 1586 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) |
1590 // Disable MemoryPressureListener when memory coordinator is enabled. | 1587 MemoryCoordinatorImpl::GetInstance()->Start(); |
1591 base::MemoryPressureListener::SetNotificationsSuppressed(true); | |
1592 auto* coordinator = MemoryCoordinatorImpl::GetInstance(); | |
1593 if (memory_pressure_monitor_) { | |
1594 memory_pressure_monitor_->SetDispatchCallback( | |
1595 base::Bind(&MemoryCoordinatorImpl::RecordMemoryPressure, | |
1596 base::Unretained(coordinator))); | |
1597 } | |
1598 } | |
1599 | 1588 |
1600 auto* swap_metrics_observer = SwapMetricsObserver::GetInstance(); | 1589 auto* swap_metrics_observer = SwapMetricsObserver::GetInstance(); |
1601 if (swap_metrics_observer) | 1590 if (swap_metrics_observer) |
1602 swap_metrics_observer->Start(); | 1591 swap_metrics_observer->Start(); |
1603 } | 1592 } |
1604 | 1593 |
1605 bool BrowserMainLoop::InitializeToolkit() { | 1594 bool BrowserMainLoop::InitializeToolkit() { |
1606 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1595 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
1607 | 1596 |
1608 // TODO(evan): this function is rather subtle, due to the variety | 1597 // TODO(evan): this function is rather subtle, due to the variety |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 base::MakeUnique<media::AudioThreadImpl>(), | 1748 base::MakeUnique<media::AudioThreadImpl>(), |
1760 MediaInternals::GetInstance()); | 1749 MediaInternals::GetInstance()); |
1761 } | 1750 } |
1762 CHECK(audio_manager_); | 1751 CHECK(audio_manager_); |
1763 | 1752 |
1764 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1753 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
1765 CHECK(audio_system_); | 1754 CHECK(audio_system_); |
1766 } | 1755 } |
1767 | 1756 |
1768 } // namespace content | 1757 } // namespace content |
OLD | NEW |