| 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 18 matching lines...) Expand all Loading... |
| 29 #include "base/single_thread_task_runner.h" | 29 #include "base/single_thread_task_runner.h" |
| 30 #include "base/strings/string_number_conversions.h" | 30 #include "base/strings/string_number_conversions.h" |
| 31 #include "base/strings/string_split.h" | 31 #include "base/strings/string_split.h" |
| 32 #include "base/system_monitor/system_monitor.h" | 32 #include "base/system_monitor/system_monitor.h" |
| 33 #include "base/threading/thread_restrictions.h" | 33 #include "base/threading/thread_restrictions.h" |
| 34 #include "base/threading/thread_task_runner_handle.h" | 34 #include "base/threading/thread_task_runner_handle.h" |
| 35 #include "base/timer/hi_res_timer_manager.h" | 35 #include "base/timer/hi_res_timer_manager.h" |
| 36 #include "base/trace_event/memory_dump_manager.h" | 36 #include "base/trace_event/memory_dump_manager.h" |
| 37 #include "base/trace_event/trace_event.h" | 37 #include "base/trace_event/trace_event.h" |
| 38 #include "build/build_config.h" | 38 #include "build/build_config.h" |
| 39 #include "components/memory_coordinator/browser/memory_coordinator_impl.h" |
| 40 #include "components/memory_coordinator/common/memory_coordinator_features.h" |
| 39 #include "components/tracing/browser/trace_config_file.h" | 41 #include "components/tracing/browser/trace_config_file.h" |
| 40 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 42 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
| 41 #include "components/tracing/common/trace_to_console.h" | 43 #include "components/tracing/common/trace_to_console.h" |
| 42 #include "components/tracing/common/tracing_switches.h" | 44 #include "components/tracing/common/tracing_switches.h" |
| 43 #include "content/browser/browser_thread_impl.h" | 45 #include "content/browser/browser_thread_impl.h" |
| 44 #include "content/browser/device_sensors/device_inertial_sensor_service.h" | 46 #include "content/browser/device_sensors/device_inertial_sensor_service.h" |
| 45 #include "content/browser/dom_storage/dom_storage_area.h" | 47 #include "content/browser/dom_storage/dom_storage_area.h" |
| 46 #include "content/browser/download/save_file_manager.h" | 48 #include "content/browser/download/save_file_manager.h" |
| 47 #include "content/browser/gamepad/gamepad_service.h" | 49 #include "content/browser/gamepad/gamepad_service.h" |
| 48 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 50 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( | 721 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
| 720 chromeos::switches::GetMemoryPressureThresholds())); | 722 chromeos::switches::GetMemoryPressureThresholds())); |
| 721 } | 723 } |
| 722 #elif defined(OS_MACOSX) | 724 #elif defined(OS_MACOSX) |
| 723 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 725 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
| 724 #elif defined(OS_WIN) | 726 #elif defined(OS_WIN) |
| 725 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 727 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
| 726 parsed_command_line_)); | 728 parsed_command_line_)); |
| 727 #endif | 729 #endif |
| 728 | 730 |
| 731 if (memory_coordinator::IsEnabled()) { |
| 732 memory_coordinator_.reset(new memory_coordinator::MemoryCoordinatorImpl); |
| 733 } |
| 734 |
| 729 #if defined(ENABLE_PLUGINS) | 735 #if defined(ENABLE_PLUGINS) |
| 730 // Prior to any processing happening on the IO thread, we create the | 736 // Prior to any processing happening on the IO thread, we create the |
| 731 // plugin service as it is predominantly used from the IO thread, | 737 // plugin service as it is predominantly used from the IO thread, |
| 732 // but must be created on the main thread. The service ctor is | 738 // but must be created on the main thread. The service ctor is |
| 733 // inexpensive and does not invoke the io_thread() accessor. | 739 // inexpensive and does not invoke the io_thread() accessor. |
| 734 { | 740 { |
| 735 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 741 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
| 736 PluginService::GetInstance()->Init(); | 742 PluginService::GetInstance()->Init(); |
| 737 } | 743 } |
| 738 #endif | 744 #endif |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 1001 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
| 996 resource_dispatcher_host_->Shutdown(); | 1002 resource_dispatcher_host_->Shutdown(); |
| 997 } | 1003 } |
| 998 // Request shutdown to clean up allocated resources on the IO thread. | 1004 // Request shutdown to clean up allocated resources on the IO thread. |
| 999 if (midi_manager_) { | 1005 if (midi_manager_) { |
| 1000 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); | 1006 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
| 1001 midi_manager_->Shutdown(); | 1007 midi_manager_->Shutdown(); |
| 1002 } | 1008 } |
| 1003 | 1009 |
| 1004 memory_pressure_monitor_.reset(); | 1010 memory_pressure_monitor_.reset(); |
| 1011 memory_coordinator_.reset(); |
| 1005 | 1012 |
| 1006 #if defined(OS_MACOSX) | 1013 #if defined(OS_MACOSX) |
| 1007 BrowserCompositorMac::DisableRecyclingForShutdown(); | 1014 BrowserCompositorMac::DisableRecyclingForShutdown(); |
| 1008 #endif | 1015 #endif |
| 1009 | 1016 |
| 1010 #if defined(USE_AURA) || defined(OS_MACOSX) | 1017 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 1011 { | 1018 { |
| 1012 TRACE_EVENT0("shutdown", | 1019 TRACE_EVENT0("shutdown", |
| 1013 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 1020 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
| 1014 ImageTransportFactory::Terminate(); | 1021 ImageTransportFactory::Terminate(); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1517 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1511 audio_thread_->task_runner(); | 1518 audio_thread_->task_runner(); |
| 1512 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1519 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1513 std::move(worker_task_runner), | 1520 std::move(worker_task_runner), |
| 1514 MediaInternals::GetInstance()); | 1521 MediaInternals::GetInstance()); |
| 1515 } | 1522 } |
| 1516 CHECK(audio_manager_); | 1523 CHECK(audio_manager_); |
| 1517 } | 1524 } |
| 1518 | 1525 |
| 1519 } // namespace content | 1526 } // namespace content |
| OLD | NEW |