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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 memory_pressure_monitor_ = | 1521 memory_pressure_monitor_ = |
1522 base::MakeUnique<base::mac::MemoryPressureMonitor>(); | 1522 base::MakeUnique<base::mac::MemoryPressureMonitor>(); |
1523 #elif defined(OS_WIN) | 1523 #elif defined(OS_WIN) |
1524 memory_pressure_monitor_ = | 1524 memory_pressure_monitor_ = |
1525 CreateWinMemoryPressureMonitor(parsed_command_line_); | 1525 CreateWinMemoryPressureMonitor(parsed_command_line_); |
1526 #endif | 1526 #endif |
1527 | 1527 |
1528 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 1528 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
1529 // Disable MemoryPressureListener when memory coordinator is enabled. | 1529 // Disable MemoryPressureListener when memory coordinator is enabled. |
1530 base::MemoryPressureListener::SetNotificationsSuppressed(true); | 1530 base::MemoryPressureListener::SetNotificationsSuppressed(true); |
1531 // base::Unretained is safe because the lifetime of MemoryCoordinator is | 1531 base::MemoryCoordinatorProxy::GetInstance()->Set( |
1532 // tied to the lifetime of the browser process. | 1532 MemoryCoordinator::GetInstance()->GetWeakPtr()); |
1533 base::MemoryCoordinatorProxy::GetInstance()-> | |
1534 SetGetCurrentMemoryStateCallback(base::Bind( | |
1535 &MemoryCoordinator::GetCurrentMemoryState, | |
1536 base::Unretained(MemoryCoordinator::GetInstance()))); | |
1537 base::MemoryCoordinatorProxy::GetInstance()-> | |
1538 SetSetCurrentMemoryStateForTestingCallback(base::Bind( | |
1539 &MemoryCoordinator::SetCurrentMemoryStateForTesting, | |
1540 base::Unretained(MemoryCoordinator::GetInstance()))); | |
1541 | 1533 |
1542 if (memory_pressure_monitor_) { | 1534 if (memory_pressure_monitor_) { |
1543 memory_pressure_monitor_->SetDispatchCallback( | 1535 memory_pressure_monitor_->SetDispatchCallback( |
1544 base::Bind(&MemoryCoordinator::RecordMemoryPressure, | 1536 base::Bind(&MemoryCoordinator::RecordMemoryPressure, |
1545 base::Unretained(MemoryCoordinator::GetInstance()))); | 1537 base::Unretained(MemoryCoordinator::GetInstance()))); |
1546 } | 1538 } |
1547 } | 1539 } |
1548 } | 1540 } |
1549 | 1541 |
1550 bool BrowserMainLoop::InitializeToolkit() { | 1542 bool BrowserMainLoop::InitializeToolkit() { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 if (!audio_manager_) { | 1693 if (!audio_manager_) { |
1702 audio_thread_ = base::MakeUnique<AudioDeviceThread>(); | 1694 audio_thread_ = base::MakeUnique<AudioDeviceThread>(); |
1703 audio_manager_ = media::AudioManager::Create( | 1695 audio_manager_ = media::AudioManager::Create( |
1704 audio_thread_->GetTaskRunner(), audio_thread_->worker_task_runner(), | 1696 audio_thread_->GetTaskRunner(), audio_thread_->worker_task_runner(), |
1705 MediaInternals::GetInstance()); | 1697 MediaInternals::GetInstance()); |
1706 } | 1698 } |
1707 CHECK(audio_manager_); | 1699 CHECK(audio_manager_); |
1708 } | 1700 } |
1709 | 1701 |
1710 } // namespace content | 1702 } // namespace content |
OLD | NEW |