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