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_state_notifier.h" |
39 #include "components/tracing/browser/trace_config_file.h" | 40 #include "components/tracing/browser/trace_config_file.h" |
40 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 41 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
41 #include "components/tracing/common/trace_to_console.h" | 42 #include "components/tracing/common/trace_to_console.h" |
42 #include "components/tracing/common/tracing_switches.h" | 43 #include "components/tracing/common/tracing_switches.h" |
43 #include "content/browser/browser_thread_impl.h" | 44 #include "content/browser/browser_thread_impl.h" |
44 #include "content/browser/device_sensors/device_inertial_sensor_service.h" | 45 #include "content/browser/device_sensors/device_inertial_sensor_service.h" |
45 #include "content/browser/dom_storage/dom_storage_area.h" | 46 #include "content/browser/dom_storage/dom_storage_area.h" |
46 #include "content/browser/download/save_file_manager.h" | 47 #include "content/browser/download/save_file_manager.h" |
47 #include "content/browser/gamepad/gamepad_service.h" | 48 #include "content/browser/gamepad/gamepad_service.h" |
48 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 49 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( | 714 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
714 chromeos::switches::GetMemoryPressureThresholds())); | 715 chromeos::switches::GetMemoryPressureThresholds())); |
715 } | 716 } |
716 #elif defined(OS_MACOSX) | 717 #elif defined(OS_MACOSX) |
717 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 718 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
718 #elif defined(OS_WIN) | 719 #elif defined(OS_WIN) |
719 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 720 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
720 parsed_command_line_)); | 721 parsed_command_line_)); |
721 #endif | 722 #endif |
722 | 723 |
| 724 if (memory_coordinator::IsEnabled()) { |
| 725 memory_state_notifier_.reset(new memory_coordinator::MemoryStateNotifier); |
| 726 } |
| 727 |
723 #if defined(ENABLE_PLUGINS) | 728 #if defined(ENABLE_PLUGINS) |
724 // Prior to any processing happening on the IO thread, we create the | 729 // Prior to any processing happening on the IO thread, we create the |
725 // plugin service as it is predominantly used from the IO thread, | 730 // plugin service as it is predominantly used from the IO thread, |
726 // but must be created on the main thread. The service ctor is | 731 // but must be created on the main thread. The service ctor is |
727 // inexpensive and does not invoke the io_thread() accessor. | 732 // inexpensive and does not invoke the io_thread() accessor. |
728 { | 733 { |
729 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 734 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
730 PluginService::GetInstance()->Init(); | 735 PluginService::GetInstance()->Init(); |
731 } | 736 } |
732 #endif | 737 #endif |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 994 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
990 resource_dispatcher_host_->Shutdown(); | 995 resource_dispatcher_host_->Shutdown(); |
991 } | 996 } |
992 // Request shutdown to clean up allocated resources on the IO thread. | 997 // Request shutdown to clean up allocated resources on the IO thread. |
993 if (midi_manager_) { | 998 if (midi_manager_) { |
994 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); | 999 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
995 midi_manager_->Shutdown(); | 1000 midi_manager_->Shutdown(); |
996 } | 1001 } |
997 | 1002 |
998 memory_pressure_monitor_.reset(); | 1003 memory_pressure_monitor_.reset(); |
| 1004 memory_state_notifier_.reset(); |
999 | 1005 |
1000 #if defined(OS_MACOSX) | 1006 #if defined(OS_MACOSX) |
1001 BrowserCompositorMac::DisableRecyclingForShutdown(); | 1007 BrowserCompositorMac::DisableRecyclingForShutdown(); |
1002 #endif | 1008 #endif |
1003 | 1009 |
1004 #if defined(USE_AURA) || defined(OS_MACOSX) | 1010 #if defined(USE_AURA) || defined(OS_MACOSX) |
1005 { | 1011 { |
1006 TRACE_EVENT0("shutdown", | 1012 TRACE_EVENT0("shutdown", |
1007 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 1013 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
1008 ImageTransportFactory::Terminate(); | 1014 ImageTransportFactory::Terminate(); |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 std::move(worker_task_runner), | 1510 std::move(worker_task_runner), |
1505 MediaInternals::GetInstance()); | 1511 MediaInternals::GetInstance()); |
1506 } | 1512 } |
1507 CHECK(audio_manager_); | 1513 CHECK(audio_manager_); |
1508 | 1514 |
1509 if (use_hang_monitor) | 1515 if (use_hang_monitor) |
1510 media::AudioManager::StartHangMonitor(io_thread_->task_runner()); | 1516 media::AudioManager::StartHangMonitor(io_thread_->task_runner()); |
1511 } | 1517 } |
1512 | 1518 |
1513 } // namespace content | 1519 } // namespace content |
OLD | NEW |