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" | |
41 #include "components/tracing/browser/trace_config_file.h" | 39 #include "components/tracing/browser/trace_config_file.h" |
42 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 40 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
43 #include "components/tracing/common/trace_to_console.h" | 41 #include "components/tracing/common/trace_to_console.h" |
44 #include "components/tracing/common/tracing_switches.h" | 42 #include "components/tracing/common/tracing_switches.h" |
45 #include "content/browser/browser_thread_impl.h" | 43 #include "content/browser/browser_thread_impl.h" |
46 #include "content/browser/device_sensors/device_sensor_service.h" | 44 #include "content/browser/device_sensors/device_sensor_service.h" |
47 #include "content/browser/dom_storage/dom_storage_area.h" | 45 #include "content/browser/dom_storage/dom_storage_area.h" |
48 #include "content/browser/download/save_file_manager.h" | 46 #include "content/browser/download/save_file_manager.h" |
49 #include "content/browser/gamepad/gamepad_service.h" | 47 #include "content/browser/gamepad/gamepad_service.h" |
50 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 48 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( | 706 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
709 chromeos::switches::GetMemoryPressureThresholds())); | 707 chromeos::switches::GetMemoryPressureThresholds())); |
710 } | 708 } |
711 #elif defined(OS_MACOSX) | 709 #elif defined(OS_MACOSX) |
712 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 710 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
713 #elif defined(OS_WIN) | 711 #elif defined(OS_WIN) |
714 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 712 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
715 parsed_command_line_)); | 713 parsed_command_line_)); |
716 #endif | 714 #endif |
717 | 715 |
718 if (memory_coordinator::IsEnabled()) { | |
719 memory_coordinator_.reset(new memory_coordinator::MemoryCoordinator); | |
720 } | |
721 | |
722 #if defined(ENABLE_PLUGINS) | 716 #if defined(ENABLE_PLUGINS) |
723 // Prior to any processing happening on the IO thread, we create the | 717 // Prior to any processing happening on the IO thread, we create the |
724 // plugin service as it is predominantly used from the IO thread, | 718 // plugin service as it is predominantly used from the IO thread, |
725 // but must be created on the main thread. The service ctor is | 719 // but must be created on the main thread. The service ctor is |
726 // inexpensive and does not invoke the io_thread() accessor. | 720 // inexpensive and does not invoke the io_thread() accessor. |
727 { | 721 { |
728 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 722 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
729 PluginService::GetInstance()->Init(); | 723 PluginService::GetInstance()->Init(); |
730 } | 724 } |
731 #endif | 725 #endif |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 1007 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
1014 resource_dispatcher_host_->Shutdown(); | 1008 resource_dispatcher_host_->Shutdown(); |
1015 } | 1009 } |
1016 // Request shutdown to clean up allocated resources on the IO thread. | 1010 // Request shutdown to clean up allocated resources on the IO thread. |
1017 if (midi_manager_) { | 1011 if (midi_manager_) { |
1018 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); | 1012 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
1019 midi_manager_->Shutdown(); | 1013 midi_manager_->Shutdown(); |
1020 } | 1014 } |
1021 | 1015 |
1022 memory_pressure_monitor_.reset(); | 1016 memory_pressure_monitor_.reset(); |
1023 memory_coordinator_.reset(); | |
1024 | 1017 |
1025 #if defined(OS_MACOSX) | 1018 #if defined(OS_MACOSX) |
1026 BrowserCompositorMac::DisableRecyclingForShutdown(); | 1019 BrowserCompositorMac::DisableRecyclingForShutdown(); |
1027 #endif | 1020 #endif |
1028 | 1021 |
1029 #if defined(USE_AURA) || defined(OS_MACOSX) | 1022 #if defined(USE_AURA) || defined(OS_MACOSX) |
1030 { | 1023 { |
1031 TRACE_EVENT0("shutdown", | 1024 TRACE_EVENT0("shutdown", |
1032 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 1025 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
1033 ImageTransportFactory::Terminate(); | 1026 ImageTransportFactory::Terminate(); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1526 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
1534 audio_thread_->task_runner(); | 1527 audio_thread_->task_runner(); |
1535 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1528 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
1536 std::move(worker_task_runner), | 1529 std::move(worker_task_runner), |
1537 MediaInternals::GetInstance()); | 1530 MediaInternals::GetInstance()); |
1538 } | 1531 } |
1539 CHECK(audio_manager_); | 1532 CHECK(audio_manager_); |
1540 } | 1533 } |
1541 | 1534 |
1542 } // namespace content | 1535 } // namespace content |
OLD | NEW |