| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); | 672 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); |
| 672 } | 673 } |
| 673 | 674 |
| 674 if (parsed_command_line_.HasSwitch( | 675 if (parsed_command_line_.HasSwitch( |
| 675 switches::kEnableAggressiveDOMStorageFlushing)) { | 676 switches::kEnableAggressiveDOMStorageFlushing)) { |
| 676 TRACE_EVENT0("startup", | 677 TRACE_EVENT0("startup", |
| 677 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay"); | 678 "BrowserMainLoop::Subsystem:EnableAggressiveCommitDelay"); |
| 678 DOMStorageArea::EnableAggressiveCommitDelay(); | 679 DOMStorageArea::EnableAggressiveCommitDelay(); |
| 679 } | 680 } |
| 680 | 681 |
| 682 if (parsed_command_line_.HasSwitch( |
| 683 switches::kEnableMemoryCoordinator)) { |
| 684 memory_state_notifier_.reset(new memory_coordinator::MemoryStateNotifier); |
| 685 } |
| 686 |
| 681 // Enable memory-infra dump providers. | 687 // Enable memory-infra dump providers. |
| 682 InitSkiaEventTracer(); | 688 InitSkiaEventTracer(); |
| 683 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess( | 689 tracing::ProcessMetricsMemoryDumpProvider::RegisterForProcess( |
| 684 base::kNullProcessId); | 690 base::kNullProcessId); |
| 685 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 691 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 686 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); | 692 HostSharedBitmapManager::current(), "HostSharedBitmapManager", nullptr); |
| 687 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 693 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 688 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); | 694 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); |
| 689 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 695 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 690 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); | 696 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 995 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
| 990 resource_dispatcher_host_->Shutdown(); | 996 resource_dispatcher_host_->Shutdown(); |
| 991 } | 997 } |
| 992 // Request shutdown to clean up allocated resources on the IO thread. | 998 // Request shutdown to clean up allocated resources on the IO thread. |
| 993 if (midi_manager_) { | 999 if (midi_manager_) { |
| 994 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); | 1000 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
| 995 midi_manager_->Shutdown(); | 1001 midi_manager_->Shutdown(); |
| 996 } | 1002 } |
| 997 | 1003 |
| 998 memory_pressure_monitor_.reset(); | 1004 memory_pressure_monitor_.reset(); |
| 1005 memory_state_notifier_.reset(); |
| 999 | 1006 |
| 1000 #if defined(OS_MACOSX) | 1007 #if defined(OS_MACOSX) |
| 1001 BrowserCompositorMac::DisableRecyclingForShutdown(); | 1008 BrowserCompositorMac::DisableRecyclingForShutdown(); |
| 1002 #endif | 1009 #endif |
| 1003 | 1010 |
| 1004 #if defined(USE_AURA) || defined(OS_MACOSX) | 1011 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 1005 { | 1012 { |
| 1006 TRACE_EVENT0("shutdown", | 1013 TRACE_EVENT0("shutdown", |
| 1007 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 1014 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
| 1008 ImageTransportFactory::Terminate(); | 1015 ImageTransportFactory::Terminate(); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 std::move(worker_task_runner), | 1511 std::move(worker_task_runner), |
| 1505 MediaInternals::GetInstance()); | 1512 MediaInternals::GetInstance()); |
| 1506 } | 1513 } |
| 1507 CHECK(audio_manager_); | 1514 CHECK(audio_manager_); |
| 1508 | 1515 |
| 1509 if (use_hang_monitor) | 1516 if (use_hang_monitor) |
| 1510 media::AudioManager::StartHangMonitor(io_thread_->task_runner()); | 1517 media::AudioManager::StartHangMonitor(io_thread_->task_runner()); |
| 1511 } | 1518 } |
| 1512 | 1519 |
| 1513 } // namespace content | 1520 } // namespace content |
| OLD | NEW |