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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/feature_list.h" | 15 #include "base/feature_list.h" |
| 16 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/memory_coordinator_proxy.h" | |
| 19 #include "base/memory/memory_pressure_monitor.h" | 20 #include "base/memory/memory_pressure_monitor.h" |
| 20 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/field_trial.h" | 22 #include "base/metrics/field_trial.h" |
| 22 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
| 23 #include "base/metrics/user_metrics.h" | 24 #include "base/metrics/user_metrics.h" |
| 24 #include "base/pending_task.h" | 25 #include "base/pending_task.h" |
| 25 #include "base/power_monitor/power_monitor.h" | 26 #include "base/power_monitor/power_monitor.h" |
| 26 #include "base/power_monitor/power_monitor_device_source.h" | 27 #include "base/power_monitor/power_monitor_device_source.h" |
| 27 #include "base/process/process_metrics.h" | 28 #include "base/process/process_metrics.h" |
| 28 #include "base/run_loop.h" | 29 #include "base/run_loop.h" |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1386 | 1387 |
| 1387 bool BrowserMainLoop::UsingInProcessGpu() const { | 1388 bool BrowserMainLoop::UsingInProcessGpu() const { |
| 1388 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || | 1389 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || |
| 1389 parsed_command_line_.HasSwitch(switches::kInProcessGPU); | 1390 parsed_command_line_.HasSwitch(switches::kInProcessGPU); |
| 1390 } | 1391 } |
| 1391 | 1392 |
| 1392 void BrowserMainLoop::InitializeMemoryManagementComponent() { | 1393 void BrowserMainLoop::InitializeMemoryManagementComponent() { |
| 1393 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { | 1394 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { |
| 1394 // Disable MemoryPressureListener when memory coordinator is enabled. | 1395 // Disable MemoryPressureListener when memory coordinator is enabled. |
| 1395 base::MemoryPressureListener::SetNotificationsSuppressed(true); | 1396 base::MemoryPressureListener::SetNotificationsSuppressed(true); |
| 1397 base::MemoryCoordinatorProxy::GetInstance()-> | |
| 1398 SetGetCurrentMemoryStateCallback(base::Bind( | |
| 1399 &MemoryCoordinator::GetCurrentMemoryState, | |
| 1400 base::Unretained(MemoryCoordinator::GetInstance()))); | |
|
danakj
2016/10/21 18:56:30
Can you leave a comment explaining why Unretained
hajimehoshi
2016/10/24 06:51:06
Done.
| |
| 1396 return; | 1401 return; |
| 1397 } | 1402 } |
| 1398 | 1403 |
| 1399 // TODO(chrisha): Abstract away this construction mess to a helper function, | 1404 // TODO(chrisha): Abstract away this construction mess to a helper function, |
| 1400 // once MemoryPressureMonitor is made a concrete class. | 1405 // once MemoryPressureMonitor is made a concrete class. |
| 1401 #if defined(OS_CHROMEOS) | 1406 #if defined(OS_CHROMEOS) |
| 1402 if (chromeos::switches::MemoryPressureHandlingEnabled()) { | 1407 if (chromeos::switches::MemoryPressureHandlingEnabled()) { |
| 1403 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( | 1408 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
| 1404 chromeos::switches::GetMemoryPressureThresholds())); | 1409 chromeos::switches::GetMemoryPressureThresholds())); |
| 1405 } | 1410 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1581 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1586 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1582 audio_thread_->task_runner(); | 1587 audio_thread_->task_runner(); |
| 1583 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1588 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1584 std::move(worker_task_runner), | 1589 std::move(worker_task_runner), |
| 1585 MediaInternals::GetInstance()); | 1590 MediaInternals::GetInstance()); |
| 1586 } | 1591 } |
| 1587 CHECK(audio_manager_); | 1592 CHECK(audio_manager_); |
| 1588 } | 1593 } |
| 1589 | 1594 |
| 1590 } // namespace content | 1595 } // namespace content |
| OLD | NEW |