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 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 memory_pressure_monitor_ = | 1611 memory_pressure_monitor_ = |
1612 base::MakeUnique<base::mac::MemoryPressureMonitor>(); | 1612 base::MakeUnique<base::mac::MemoryPressureMonitor>(); |
1613 #elif defined(OS_WIN) | 1613 #elif defined(OS_WIN) |
1614 memory_pressure_monitor_ = | 1614 memory_pressure_monitor_ = |
1615 CreateWinMemoryPressureMonitor(parsed_command_line_); | 1615 CreateWinMemoryPressureMonitor(parsed_command_line_); |
1616 #endif | 1616 #endif |
1617 | 1617 |
1618 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 1618 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
1619 // Disable MemoryPressureListener when memory coordinator is enabled. | 1619 // Disable MemoryPressureListener when memory coordinator is enabled. |
1620 base::MemoryPressureListener::SetNotificationsSuppressed(true); | 1620 base::MemoryPressureListener::SetNotificationsSuppressed(true); |
1621 // base::Unretained is safe because the lifetime of MemoryCoordinator is | 1621 auto* coordinator = MemoryCoordinatorImpl::GetInstance(); |
1622 // tied to the lifetime of the browser process. | |
1623 base::MemoryCoordinatorProxy::GetInstance()-> | |
1624 SetGetCurrentMemoryStateCallback(base::Bind( | |
1625 &MemoryCoordinatorImpl::GetCurrentMemoryState, | |
1626 base::Unretained(MemoryCoordinatorImpl::GetInstance()))); | |
1627 base::MemoryCoordinatorProxy::GetInstance()-> | |
1628 SetSetCurrentMemoryStateForTestingCallback(base::Bind( | |
1629 &MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting, | |
1630 base::Unretained(MemoryCoordinatorImpl::GetInstance()))); | |
1631 | |
1632 if (memory_pressure_monitor_) { | 1622 if (memory_pressure_monitor_) { |
1633 memory_pressure_monitor_->SetDispatchCallback( | 1623 memory_pressure_monitor_->SetDispatchCallback( |
1634 base::Bind(&MemoryCoordinatorImpl::RecordMemoryPressure, | 1624 base::Bind(&MemoryCoordinatorImpl::RecordMemoryPressure, |
1635 base::Unretained(MemoryCoordinatorImpl::GetInstance()))); | 1625 base::Unretained(coordinator))); |
1636 } | 1626 } |
1637 } | 1627 } |
1638 } | 1628 } |
1639 | 1629 |
1640 bool BrowserMainLoop::InitializeToolkit() { | 1630 bool BrowserMainLoop::InitializeToolkit() { |
1641 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1631 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
1642 | 1632 |
1643 // TODO(evan): this function is rather subtle, due to the variety | 1633 // TODO(evan): this function is rather subtle, due to the variety |
1644 // of intersecting ifdefs we have. To keep it easy to follow, there | 1634 // of intersecting ifdefs we have. To keep it easy to follow, there |
1645 // are no #else branches on any #ifs. | 1635 // are no #else branches on any #ifs. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1786 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
1797 MediaInternals::GetInstance()); | 1787 MediaInternals::GetInstance()); |
1798 } | 1788 } |
1799 CHECK(audio_manager_); | 1789 CHECK(audio_manager_); |
1800 | 1790 |
1801 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1791 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
1802 CHECK(audio_system_); | 1792 CHECK(audio_system_); |
1803 } | 1793 } |
1804 | 1794 |
1805 } // namespace content | 1795 } // namespace content |
OLD | NEW |