| 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.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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( | 716 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
| 715 chromeos::switches::GetMemoryPressureThresholds())); | 717 chromeos::switches::GetMemoryPressureThresholds())); |
| 716 } | 718 } |
| 717 #elif defined(OS_MACOSX) | 719 #elif defined(OS_MACOSX) |
| 718 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 720 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
| 719 #elif defined(OS_WIN) | 721 #elif defined(OS_WIN) |
| 720 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 722 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
| 721 parsed_command_line_)); | 723 parsed_command_line_)); |
| 722 #endif | 724 #endif |
| 723 | 725 |
| 726 if (memory_coordinator::IsEnabled()) { |
| 727 memory_coordinator_.reset(new memory_coordinator::MemoryCoordinator); |
| 728 } |
| 729 |
| 724 #if defined(ENABLE_PLUGINS) | 730 #if defined(ENABLE_PLUGINS) |
| 725 // Prior to any processing happening on the IO thread, we create the | 731 // Prior to any processing happening on the IO thread, we create the |
| 726 // plugin service as it is predominantly used from the IO thread, | 732 // plugin service as it is predominantly used from the IO thread, |
| 727 // but must be created on the main thread. The service ctor is | 733 // but must be created on the main thread. The service ctor is |
| 728 // inexpensive and does not invoke the io_thread() accessor. | 734 // inexpensive and does not invoke the io_thread() accessor. |
| 729 { | 735 { |
| 730 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 736 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
| 731 PluginService::GetInstance()->Init(); | 737 PluginService::GetInstance()->Init(); |
| 732 } | 738 } |
| 733 #endif | 739 #endif |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 996 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
| 991 resource_dispatcher_host_->Shutdown(); | 997 resource_dispatcher_host_->Shutdown(); |
| 992 } | 998 } |
| 993 // Request shutdown to clean up allocated resources on the IO thread. | 999 // Request shutdown to clean up allocated resources on the IO thread. |
| 994 if (midi_manager_) { | 1000 if (midi_manager_) { |
| 995 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); | 1001 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
| 996 midi_manager_->Shutdown(); | 1002 midi_manager_->Shutdown(); |
| 997 } | 1003 } |
| 998 | 1004 |
| 999 memory_pressure_monitor_.reset(); | 1005 memory_pressure_monitor_.reset(); |
| 1006 memory_coordinator_.reset(); |
| 1000 | 1007 |
| 1001 #if defined(OS_MACOSX) | 1008 #if defined(OS_MACOSX) |
| 1002 BrowserCompositorMac::DisableRecyclingForShutdown(); | 1009 BrowserCompositorMac::DisableRecyclingForShutdown(); |
| 1003 #endif | 1010 #endif |
| 1004 | 1011 |
| 1005 #if defined(USE_AURA) || defined(OS_MACOSX) | 1012 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 1006 { | 1013 { |
| 1007 TRACE_EVENT0("shutdown", | 1014 TRACE_EVENT0("shutdown", |
| 1008 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 1015 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
| 1009 ImageTransportFactory::Terminate(); | 1016 ImageTransportFactory::Terminate(); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1519 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
| 1513 audio_thread_->task_runner(); | 1520 audio_thread_->task_runner(); |
| 1514 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1521 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
| 1515 std::move(worker_task_runner), | 1522 std::move(worker_task_runner), |
| 1516 MediaInternals::GetInstance()); | 1523 MediaInternals::GetInstance()); |
| 1517 } | 1524 } |
| 1518 CHECK(audio_manager_); | 1525 CHECK(audio_manager_); |
| 1519 } | 1526 } |
| 1520 | 1527 |
| 1521 } // namespace content | 1528 } // namespace content |
| OLD | NEW |