| 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 chromeos::switches::GetMemoryPressureThresholds())); | 683 chromeos::switches::GetMemoryPressureThresholds())); |
| 684 } | 684 } |
| 685 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 685 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 686 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); | 686 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor()); |
| 687 #elif defined(OS_WIN) | 687 #elif defined(OS_WIN) |
| 688 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( | 688 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( |
| 689 parsed_command_line_)); | 689 parsed_command_line_)); |
| 690 #endif | 690 #endif |
| 691 | 691 |
| 692 #if defined(ENABLE_PLUGINS) | 692 #if defined(ENABLE_PLUGINS) |
| 693 // Prior to any processing happening on the io thread, we create the | 693 // Prior to any processing happening on the IO thread, we create the |
| 694 // plugin service as it is predominantly used from the io thread, | 694 // plugin service as it is predominantly used from the IO thread, |
| 695 // but must be created on the main thread. The service ctor is | 695 // but must be created on the main thread. The service ctor is |
| 696 // inexpensive and does not invoke the io_thread() accessor. | 696 // inexpensive and does not invoke the io_thread() accessor. |
| 697 { | 697 { |
| 698 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); | 698 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); |
| 699 PluginService::GetInstance()->Init(); | 699 PluginService::GetInstance()->Init(); |
| 700 } | 700 } |
| 701 #endif | 701 #endif |
| 702 | 702 |
| 703 #if defined(OS_MACOSX) | 703 #if defined(OS_MACOSX) |
| 704 { | 704 { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 // stopping the GPU thread. The GPU thread will close IPC channels to renderer | 941 // stopping the GPU thread. The GPU thread will close IPC channels to renderer |
| 942 // processes so this has to happen before stopping the IO thread. | 942 // processes so this has to happen before stopping the IO thread. |
| 943 { | 943 { |
| 944 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); | 944 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); |
| 945 GpuProcessHostUIShim::DestroyAll(); | 945 GpuProcessHostUIShim::DestroyAll(); |
| 946 } | 946 } |
| 947 // Cancel pending requests and prevent new requests. | 947 // Cancel pending requests and prevent new requests. |
| 948 if (resource_dispatcher_host_) { | 948 if (resource_dispatcher_host_) { |
| 949 TRACE_EVENT0("shutdown", | 949 TRACE_EVENT0("shutdown", |
| 950 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 950 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
| 951 resource_dispatcher_host_.get()->Shutdown(); | 951 resource_dispatcher_host_->Shutdown(); |
| 952 } |
| 953 // Request shutdown to clean up allocated resources on the IO thread. |
| 954 if (midi_manager_) { |
| 955 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:MidiManager"); |
| 956 midi_manager_->Shutdown(); |
| 952 } | 957 } |
| 953 | 958 |
| 954 memory_pressure_monitor_.reset(); | 959 memory_pressure_monitor_.reset(); |
| 955 | 960 |
| 956 #if defined(OS_MACOSX) | 961 #if defined(OS_MACOSX) |
| 957 BrowserCompositorMac::DisableRecyclingForShutdown(); | 962 BrowserCompositorMac::DisableRecyclingForShutdown(); |
| 958 #endif | 963 #endif |
| 959 | 964 |
| 960 #if defined(USE_AURA) || defined(OS_MACOSX) | 965 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 961 { | 966 { |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 DCHECK(is_tracing_startup_for_duration_); | 1387 DCHECK(is_tracing_startup_for_duration_); |
| 1383 | 1388 |
| 1384 is_tracing_startup_for_duration_ = false; | 1389 is_tracing_startup_for_duration_ = false; |
| 1385 TracingController::GetInstance()->DisableRecording( | 1390 TracingController::GetInstance()->DisableRecording( |
| 1386 TracingController::CreateFileSink( | 1391 TracingController::CreateFileSink( |
| 1387 startup_trace_file_, | 1392 startup_trace_file_, |
| 1388 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1393 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1389 } | 1394 } |
| 1390 | 1395 |
| 1391 } // namespace content | 1396 } // namespace content |
| OLD | NEW |