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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 chromeos::switches::GetMemoryPressureThresholds())); | 682 chromeos::switches::GetMemoryPressureThresholds())); |
683 } | 683 } |
684 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 684 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
685 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 685 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
686 #elif defined(OS_WIN) | 686 #elif defined(OS_WIN) |
687 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 687 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
688 parsed_command_line_)); | 688 parsed_command_line_)); |
689 #endif | 689 #endif |
690 | 690 |
691 #if defined(ENABLE_PLUGINS) | 691 #if defined(ENABLE_PLUGINS) |
692 // Prior to any processing happening on the io thread, we create the | 692 // Prior to any processing happening on the IO thread, we create the |
693 // plugin service as it is predominantly used from the io thread, | 693 // plugin service as it is predominantly used from the IO thread, |
694 // but must be created on the main thread. The service ctor is | 694 // but must be created on the main thread. The service ctor is |
695 // inexpensive and does not invoke the io_thread() accessor. | 695 // inexpensive and does not invoke the io_thread() accessor. |
696 { | 696 { |
697 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 697 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
698 PluginService::GetInstance()->Init(); | 698 PluginService::GetInstance()->Init(); |
699 } | 699 } |
700 #endif | 700 #endif |
701 | 701 |
702 #if defined(OS_MACOSX) | 702 #if defined(OS_MACOSX) |
703 { | 703 { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 953 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
954 // processes so this has to happen before stopping the IO thread. | 954 // processes so this has to happen before stopping the IO thread. |
955 { | 955 { |
956 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); | 956 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); |
957 GpuProcessHostUIShim::DestroyAll(); | 957 GpuProcessHostUIShim::DestroyAll(); |
958 } | 958 } |
959 // Cancel pending requests and prevent new requests. | 959 // Cancel pending requests and prevent new requests. |
960 if (resource_dispatcher_host_) { | 960 if (resource_dispatcher_host_) { |
961 TRACE_EVENT0("shutdown", | 961 TRACE_EVENT0("shutdown", |
962 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 962 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
963 resource_dispatcher_host_.get()->Shutdown(); | 963 resource_dispatcher_host_->Shutdown(); |
| 964 } |
| 965 // Request shutdown to clean up allocated resources on the IO thread. |
| 966 if (midi_manager_) { |
| 967 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
| 968 midi_manager_->Shutdown(); |
964 } | 969 } |
965 | 970 |
966 memory_pressure_monitor_.reset(); | 971 memory_pressure_monitor_.reset(); |
967 | 972 |
968 #if defined(OS_MACOSX) | 973 #if defined(OS_MACOSX) |
969 BrowserCompositorMac::DisableRecyclingForShutdown(); | 974 BrowserCompositorMac::DisableRecyclingForShutdown(); |
970 #endif | 975 #endif |
971 | 976 |
972 #if defined(USE_AURA) || defined(OS_MACOSX) | 977 #if defined(USE_AURA) || defined(OS_MACOSX) |
973 { | 978 { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 DCHECK(is_tracing_startup_for_duration_); | 1397 DCHECK(is_tracing_startup_for_duration_); |
1393 | 1398 |
1394 is_tracing_startup_for_duration_ = false; | 1399 is_tracing_startup_for_duration_ = false; |
1395 TracingController::GetInstance()->DisableRecording( | 1400 TracingController::GetInstance()->DisableRecording( |
1396 TracingController::CreateFileSink( | 1401 TracingController::CreateFileSink( |
1397 startup_trace_file_, | 1402 startup_trace_file_, |
1398 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1403 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1399 } | 1404 } |
1400 | 1405 |
1401 } // namespace content | 1406 } // namespace content |
OLD | NEW |