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/download_resource_handler.h" | 46 #include "content/browser/download/download_resource_handler.h" |
49 #include "content/browser/download/save_file_manager.h" | 47 #include "content/browser/download/save_file_manager.h" |
50 #include "content/browser/gamepad/gamepad_service.h" | 48 #include "content/browser/gamepad/gamepad_service.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( | 707 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor( |
710 chromeos::switches::GetMemoryPressureThresholds())); | 708 chromeos::switches::GetMemoryPressureThresholds())); |
711 } | 709 } |
712 #elif defined(OS_MACOSX) | 710 #elif defined(OS_MACOSX) |
713 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 711 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
714 #elif defined(OS_WIN) | 712 #elif defined(OS_WIN) |
715 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 713 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
716 parsed_command_line_)); | 714 parsed_command_line_)); |
717 #endif | 715 #endif |
718 | 716 |
719 if (memory_coordinator::IsEnabled()) { | |
720 memory_coordinator_.reset(new memory_coordinator::MemoryCoordinator); | |
721 } | |
722 | |
723 #if defined(ENABLE_PLUGINS) | 717 #if defined(ENABLE_PLUGINS) |
724 // Prior to any processing happening on the IO thread, we create the | 718 // Prior to any processing happening on the IO thread, we create the |
725 // plugin service as it is predominantly used from the IO thread, | 719 // plugin service as it is predominantly used from the IO thread, |
726 // but must be created on the main thread. The service ctor is | 720 // but must be created on the main thread. The service ctor is |
727 // inexpensive and does not invoke the io_thread() accessor. | 721 // inexpensive and does not invoke the io_thread() accessor. |
728 { | 722 { |
729 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 723 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
730 PluginService::GetInstance()->Init(); | 724 PluginService::GetInstance()->Init(); |
731 } | 725 } |
732 #endif | 726 #endif |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 1008 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
1015 resource_dispatcher_host_->Shutdown(); | 1009 resource_dispatcher_host_->Shutdown(); |
1016 } | 1010 } |
1017 // Request shutdown to clean up allocated resources on the IO thread. | 1011 // Request shutdown to clean up allocated resources on the IO thread. |
1018 if (midi_manager_) { | 1012 if (midi_manager_) { |
1019 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); | 1013 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
1020 midi_manager_->Shutdown(); | 1014 midi_manager_->Shutdown(); |
1021 } | 1015 } |
1022 | 1016 |
1023 memory_pressure_monitor_.reset(); | 1017 memory_pressure_monitor_.reset(); |
1024 memory_coordinator_.reset(); | |
1025 | 1018 |
1026 #if defined(OS_MACOSX) | 1019 #if defined(OS_MACOSX) |
1027 BrowserCompositorMac::DisableRecyclingForShutdown(); | 1020 BrowserCompositorMac::DisableRecyclingForShutdown(); |
1028 #endif | 1021 #endif |
1029 | 1022 |
1030 #if defined(USE_AURA) || defined(OS_MACOSX) | 1023 #if defined(USE_AURA) || defined(OS_MACOSX) |
1031 { | 1024 { |
1032 TRACE_EVENT0("shutdown", | 1025 TRACE_EVENT0("shutdown", |
1033 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 1026 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
1034 ImageTransportFactory::Terminate(); | 1027 ImageTransportFactory::Terminate(); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1539 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
1547 audio_thread_->task_runner(); | 1540 audio_thread_->task_runner(); |
1548 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1541 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
1549 std::move(worker_task_runner), | 1542 std::move(worker_task_runner), |
1550 MediaInternals::GetInstance()); | 1543 MediaInternals::GetInstance()); |
1551 } | 1544 } |
1552 CHECK(audio_manager_); | 1545 CHECK(audio_manager_); |
1553 } | 1546 } |
1554 | 1547 |
1555 } // namespace content | 1548 } // namespace content |
OLD | NEW |