Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 1045433002: Migrate ChromeOS to base::MemoryPressureMonitor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup/fixes Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 #include <windows.h> 95 #include <windows.h>
96 #include <commctrl.h> 96 #include <commctrl.h>
97 #include <shellapi.h> 97 #include <shellapi.h>
98 98
99 #include "content/browser/system_message_window_win.h" 99 #include "content/browser/system_message_window_win.h"
100 #include "content/common/sandbox_win.h" 100 #include "content/common/sandbox_win.h"
101 #include "net/base/winsock_init.h" 101 #include "net/base/winsock_init.h"
102 #include "ui/base/l10n/l10n_util_win.h" 102 #include "ui/base/l10n/l10n_util_win.h"
103 #endif 103 #endif
104 104
105 #if defined(OS_CHROMEOS)
106 #include "base/chromeos/memory_pressure_observer_chromeos.h"
107 #include "chromeos/chromeos_switches.h"
108 #endif
109
110 #if defined(USE_GLIB) 105 #if defined(USE_GLIB)
111 #include <glib-object.h> 106 #include <glib-object.h>
112 #endif 107 #endif
113 108
114 #if defined(OS_LINUX) && defined(USE_UDEV) 109 #if defined(OS_LINUX) && defined(USE_UDEV)
115 #include "content/browser/device_monitor_udev.h" 110 #include "content/browser/device_monitor_udev.h"
116 #elif defined(OS_MACOSX) && !defined(OS_IOS) 111 #elif defined(OS_MACOSX) && !defined(OS_IOS)
117 #include "content/browser/device_monitor_mac.h" 112 #include "content/browser/device_monitor_mac.h"
118 #endif 113 #endif
119 114
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 #endif 576 #endif
582 } 577 }
583 578
584 int BrowserMainLoop::PreCreateThreads() { 579 int BrowserMainLoop::PreCreateThreads() {
585 if (parts_) { 580 if (parts_) {
586 TRACE_EVENT0("startup", 581 TRACE_EVENT0("startup",
587 "BrowserMainLoop::CreateThreads:PreCreateThreads"); 582 "BrowserMainLoop::CreateThreads:PreCreateThreads");
588 result_code_ = parts_->PreCreateThreads(); 583 result_code_ = parts_->PreCreateThreads();
589 } 584 }
590 585
591 #if defined(OS_CHROMEOS)
592 if (chromeos::switches::MemoryPressureHandlingEnabled()) {
593 memory_pressure_observer_.reset(new base::MemoryPressureObserverChromeOS(
594 chromeos::switches::GetMemoryPressureThresholds()));
595 }
596 #endif
597
598 #if defined(ENABLE_PLUGINS) 586 #if defined(ENABLE_PLUGINS)
599 // Prior to any processing happening on the io thread, we create the 587 // Prior to any processing happening on the io thread, we create the
600 // plugin service as it is predominantly used from the io thread, 588 // plugin service as it is predominantly used from the io thread,
601 // but must be created on the main thread. The service ctor is 589 // but must be created on the main thread. The service ctor is
602 // inexpensive and does not invoke the io_thread() accessor. 590 // inexpensive and does not invoke the io_thread() accessor.
603 { 591 {
604 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService"); 592 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads:PluginService");
605 PluginService::GetInstance()->Init(); 593 PluginService::GetInstance()->Init();
606 } 594 }
607 #endif 595 #endif
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); 832 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim");
845 GpuProcessHostUIShim::DestroyAll(); 833 GpuProcessHostUIShim::DestroyAll();
846 } 834 }
847 // Cancel pending requests and prevent new requests. 835 // Cancel pending requests and prevent new requests.
848 if (resource_dispatcher_host_) { 836 if (resource_dispatcher_host_) {
849 TRACE_EVENT0("shutdown", 837 TRACE_EVENT0("shutdown",
850 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); 838 "BrowserMainLoop::Subsystem:ResourceDispatcherHost");
851 resource_dispatcher_host_.get()->Shutdown(); 839 resource_dispatcher_host_.get()->Shutdown();
852 } 840 }
853 841
854 #if defined(OS_CHROMEOS)
855 memory_pressure_observer_.reset();
856 #endif
857
858 #if defined(OS_MACOSX) 842 #if defined(OS_MACOSX)
859 BrowserCompositorMac::DisableRecyclingForShutdown(); 843 BrowserCompositorMac::DisableRecyclingForShutdown();
860 #endif 844 #endif
861 845
862 #if defined(USE_AURA) || defined(OS_MACOSX) 846 #if defined(USE_AURA) || defined(OS_MACOSX)
863 { 847 {
864 TRACE_EVENT0("shutdown", 848 TRACE_EVENT0("shutdown",
865 "BrowserMainLoop::Subsystem:ImageTransportFactory"); 849 "BrowserMainLoop::Subsystem:ImageTransportFactory");
866 ImageTransportFactory::Terminate(); 850 ImageTransportFactory::Terminate();
867 } 851 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 1261
1278 void BrowserMainLoop::EndStartupTracing() { 1262 void BrowserMainLoop::EndStartupTracing() {
1279 is_tracing_startup_ = false; 1263 is_tracing_startup_ = false;
1280 TracingController::GetInstance()->DisableRecording( 1264 TracingController::GetInstance()->DisableRecording(
1281 TracingController::CreateFileSink( 1265 TracingController::CreateFileSink(
1282 startup_trace_file_, 1266 startup_trace_file_,
1283 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1267 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1284 } 1268 }
1285 1269
1286 } // namespace content 1270 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698