| 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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 #include <windows.h> | 93 #include <windows.h> |
| 94 #include <commctrl.h> | 94 #include <commctrl.h> |
| 95 #include <shellapi.h> | 95 #include <shellapi.h> |
| 96 | 96 |
| 97 #include "content/browser/system_message_window_win.h" | 97 #include "content/browser/system_message_window_win.h" |
| 98 #include "content/common/sandbox_win.h" | 98 #include "content/common/sandbox_win.h" |
| 99 #include "net/base/winsock_init.h" | 99 #include "net/base/winsock_init.h" |
| 100 #include "ui/base/l10n/l10n_util_win.h" | 100 #include "ui/base/l10n/l10n_util_win.h" |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 #if defined(OS_CHROMEOS) |
| 104 #include "base/chromeos/memory_pressure_observer_chromeos.h" |
| 105 #include "chromeos/chromeos_switches.h" |
| 106 #endif |
| 107 |
| 103 #if defined(USE_GLIB) | 108 #if defined(USE_GLIB) |
| 104 #include <glib-object.h> | 109 #include <glib-object.h> |
| 105 #endif | 110 #endif |
| 106 | 111 |
| 107 #if defined(OS_LINUX) && defined(USE_UDEV) | 112 #if defined(OS_LINUX) && defined(USE_UDEV) |
| 108 #include "content/browser/device_monitor_udev.h" | 113 #include "content/browser/device_monitor_udev.h" |
| 109 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 114 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
| 110 #include "content/browser/device_monitor_mac.h" | 115 #include "content/browser/device_monitor_mac.h" |
| 111 #endif | 116 #endif |
| 112 | 117 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 } | 473 } |
| 469 | 474 |
| 470 #if defined(OS_WIN) | 475 #if defined(OS_WIN) |
| 471 // If we're running tests (ui_task is non-null), then the ResourceBundle | 476 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 472 // has already been initialized. | 477 // has already been initialized. |
| 473 if (!parameters_.ui_task) { | 478 if (!parameters_.ui_task) { |
| 474 // Override the configured locale with the user's preferred UI language. | 479 // Override the configured locale with the user's preferred UI language. |
| 475 l10n_util::OverrideLocaleWithUILanguageList(); | 480 l10n_util::OverrideLocaleWithUILanguageList(); |
| 476 } | 481 } |
| 477 #endif | 482 #endif |
| 478 | 483 #if defined(OS_CHROMEOS) |
| 484 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 485 chromeos::switches::kUseMemoryPressureSystemChromeOS)) { |
| 486 memory_pressure_observer_.reset(new base::MemoryPressureObserverChromeOS); |
| 487 } |
| 488 #endif |
| 479 // Create a MessageLoop if one does not already exist for the current thread. | 489 // Create a MessageLoop if one does not already exist for the current thread. |
| 480 if (!base::MessageLoop::current()) | 490 if (!base::MessageLoop::current()) |
| 481 main_message_loop_.reset(new base::MessageLoopForUI); | 491 main_message_loop_.reset(new base::MessageLoopForUI); |
| 482 | 492 |
| 483 InitializeMainThread(); | 493 InitializeMainThread(); |
| 484 | 494 |
| 485 { | 495 { |
| 486 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor"); | 496 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor"); |
| 487 system_monitor_.reset(new base::SystemMonitor); | 497 system_monitor_.reset(new base::SystemMonitor); |
| 488 } | 498 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); | 826 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); |
| 817 GpuProcessHostUIShim::DestroyAll(); | 827 GpuProcessHostUIShim::DestroyAll(); |
| 818 } | 828 } |
| 819 // Cancel pending requests and prevent new requests. | 829 // Cancel pending requests and prevent new requests. |
| 820 if (resource_dispatcher_host_) { | 830 if (resource_dispatcher_host_) { |
| 821 TRACE_EVENT0("shutdown", | 831 TRACE_EVENT0("shutdown", |
| 822 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); | 832 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); |
| 823 resource_dispatcher_host_.get()->Shutdown(); | 833 resource_dispatcher_host_.get()->Shutdown(); |
| 824 } | 834 } |
| 825 | 835 |
| 836 #if defined(OS_CHROMEOS) |
| 837 memory_pressure_observer_.reset(); |
| 838 #endif |
| 839 |
| 826 #if defined(OS_MACOSX) | 840 #if defined(OS_MACOSX) |
| 827 BrowserCompositorMac::DisableRecyclingForShutdown(); | 841 BrowserCompositorMac::DisableRecyclingForShutdown(); |
| 828 #endif | 842 #endif |
| 829 | 843 |
| 830 #if defined(USE_AURA) || defined(OS_MACOSX) | 844 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 831 { | 845 { |
| 832 TRACE_EVENT0("shutdown", | 846 TRACE_EVENT0("shutdown", |
| 833 "BrowserMainLoop::Subsystem:ImageTransportFactory"); | 847 "BrowserMainLoop::Subsystem:ImageTransportFactory"); |
| 834 ImageTransportFactory::Terminate(); | 848 ImageTransportFactory::Terminate(); |
| 835 } | 849 } |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 | 1237 |
| 1224 void BrowserMainLoop::EndStartupTracing() { | 1238 void BrowserMainLoop::EndStartupTracing() { |
| 1225 is_tracing_startup_ = false; | 1239 is_tracing_startup_ = false; |
| 1226 TracingController::GetInstance()->DisableRecording( | 1240 TracingController::GetInstance()->DisableRecording( |
| 1227 TracingController::CreateFileSink( | 1241 TracingController::CreateFileSink( |
| 1228 startup_trace_file_, | 1242 startup_trace_file_, |
| 1229 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1243 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1230 } | 1244 } |
| 1231 | 1245 |
| 1232 } // namespace content | 1246 } // namespace content |
| OLD | NEW |