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

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

Issue 1124163003: Rename OS-specific MemoryPressureMonitor implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error on ChromeOS. Created 5 years, 7 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/memory/memory_pressure_monitor.h"
10 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/pending_task.h" 14 #include "base/pending_task.h"
14 #include "base/power_monitor/power_monitor.h" 15 #include "base/power_monitor/power_monitor.h"
15 #include "base/power_monitor/power_monitor_device_source.h" 16 #include "base/power_monitor/power_monitor_device_source.h"
16 #include "base/process/process_metrics.h" 17 #include "base/process/process_metrics.h"
17 #include "base/profiler/scoped_profile.h" 18 #include "base/profiler/scoped_profile.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "base/android/jni_android.h" 85 #include "base/android/jni_android.h"
85 #include "content/browser/android/browser_startup_controller.h" 86 #include "content/browser/android/browser_startup_controller.h"
86 #include "content/browser/android/browser_surface_texture_manager.h" 87 #include "content/browser/android/browser_surface_texture_manager.h"
87 #include "content/browser/android/tracing_controller_android.h" 88 #include "content/browser/android/tracing_controller_android.h"
88 #include "content/browser/screen_orientation/screen_orientation_delegate_android .h" 89 #include "content/browser/screen_orientation/screen_orientation_delegate_android .h"
89 #include "content/public/browser/screen_orientation_provider.h" 90 #include "content/public/browser/screen_orientation_provider.h"
90 #include "ui/gl/gl_surface.h" 91 #include "ui/gl/gl_surface.h"
91 #endif 92 #endif
92 93
93 #if defined(OS_MACOSX) && !defined(OS_IOS) 94 #if defined(OS_MACOSX) && !defined(OS_IOS)
94 #include "base/mac/memory_pressure_monitor_mac.h" 95 #include "base/mac/memory_pressure_monitor.h"
95 #include "content/browser/bootstrap_sandbox_mac.h" 96 #include "content/browser/bootstrap_sandbox_mac.h"
96 #include "content/browser/cocoa/system_hotkey_helper_mac.h" 97 #include "content/browser/cocoa/system_hotkey_helper_mac.h"
97 #include "content/browser/compositor/browser_compositor_view_mac.h" 98 #include "content/browser/compositor/browser_compositor_view_mac.h"
98 #include "content/browser/theme_helper_mac.h" 99 #include "content/browser/theme_helper_mac.h"
99 #endif 100 #endif
100 101
101 #if defined(OS_WIN) 102 #if defined(OS_WIN)
102 #include <windows.h> 103 #include <windows.h>
103 #include <commctrl.h> 104 #include <commctrl.h>
104 #include <shellapi.h> 105 #include <shellapi.h>
105 106
106 #include "base/win/memory_pressure_monitor.h" 107 #include "base/win/memory_pressure_monitor.h"
107 #include "content/browser/system_message_window_win.h" 108 #include "content/browser/system_message_window_win.h"
108 #include "content/common/sandbox_win.h" 109 #include "content/common/sandbox_win.h"
109 #include "net/base/winsock_init.h" 110 #include "net/base/winsock_init.h"
110 #include "ui/base/l10n/l10n_util_win.h" 111 #include "ui/base/l10n/l10n_util_win.h"
111 #endif 112 #endif
112 113
113 #if defined(OS_CHROMEOS) 114 #if defined(OS_CHROMEOS)
114 #include "base/chromeos/memory_pressure_monitor_chromeos.h" 115 #include "base/chromeos/memory_pressure_monitor.h"
115 #include "chromeos/chromeos_switches.h" 116 #include "chromeos/chromeos_switches.h"
116 #endif 117 #endif
117 118
118 #if defined(USE_GLIB) 119 #if defined(USE_GLIB)
119 #include <glib-object.h> 120 #include <glib-object.h>
120 #endif 121 #endif
121 122
122 #if defined(OS_LINUX) && defined(USE_UDEV) 123 #if defined(OS_LINUX) && defined(USE_UDEV)
123 #include "content/browser/device_monitor_udev.h" 124 #include "content/browser/device_monitor_udev.h"
124 #elif defined(OS_MACOSX) && !defined(OS_IOS) 125 #elif defined(OS_MACOSX) && !defined(OS_IOS)
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 638
638 int BrowserMainLoop::PreCreateThreads() { 639 int BrowserMainLoop::PreCreateThreads() {
639 if (parts_) { 640 if (parts_) {
640 TRACE_EVENT0("startup", 641 TRACE_EVENT0("startup",
641 "BrowserMainLoop::CreateThreads:PreCreateThreads"); 642 "BrowserMainLoop::CreateThreads:PreCreateThreads");
642 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::PreCreateThreads"); 643 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::PreCreateThreads");
643 644
644 result_code_ = parts_->PreCreateThreads(); 645 result_code_ = parts_->PreCreateThreads();
645 } 646 }
646 647
648 // TODO(chrisha): Abstract away this construction mess to a helper function,
649 // once MemoryPressureMonitor is made a concrete class.
647 #if defined(OS_CHROMEOS) 650 #if defined(OS_CHROMEOS)
648 if (chromeos::switches::MemoryPressureHandlingEnabled()) { 651 if (chromeos::switches::MemoryPressureHandlingEnabled()) {
649 memory_pressure_monitor_.reset(new base::MemoryPressureMonitorChromeOS( 652 memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor(
650 chromeos::switches::GetMemoryPressureThresholds())); 653 chromeos::switches::GetMemoryPressureThresholds()));
651 } 654 }
652 #elif defined(OS_MACOSX) && !defined(OS_IOS) 655 #elif defined(OS_MACOSX) && !defined(OS_IOS)
653 memory_pressure_monitor_.reset(new base::MemoryPressureMonitorMac()); 656 memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor());
654 #elif defined(OS_WIN) 657 #elif defined(OS_WIN)
655 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor( 658 memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor(
656 parsed_command_line_)); 659 parsed_command_line_));
657 #endif 660 #endif
658 661
659 #if defined(ENABLE_PLUGINS) 662 #if defined(ENABLE_PLUGINS)
660 // Prior to any processing happening on the io thread, we create the 663 // Prior to any processing happening on the io thread, we create the
661 // plugin service as it is predominantly used from the io thread, 664 // plugin service as it is predominantly used from the io thread,
662 // but must be created on the main thread. The service ctor is 665 // but must be created on the main thread. The service ctor is
663 // inexpensive and does not invoke the io_thread() accessor. 666 // inexpensive and does not invoke the io_thread() accessor.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim"); 913 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUProcessHostShim");
911 GpuProcessHostUIShim::DestroyAll(); 914 GpuProcessHostUIShim::DestroyAll();
912 } 915 }
913 // Cancel pending requests and prevent new requests. 916 // Cancel pending requests and prevent new requests.
914 if (resource_dispatcher_host_) { 917 if (resource_dispatcher_host_) {
915 TRACE_EVENT0("shutdown", 918 TRACE_EVENT0("shutdown",
916 "BrowserMainLoop::Subsystem:ResourceDispatcherHost"); 919 "BrowserMainLoop::Subsystem:ResourceDispatcherHost");
917 resource_dispatcher_host_.get()->Shutdown(); 920 resource_dispatcher_host_.get()->Shutdown();
918 } 921 }
919 922
920 #if defined(OS_CHROMEOS) || defined(OS_MACOSX)
921 memory_pressure_monitor_.reset(); 923 memory_pressure_monitor_.reset();
922 #endif
923 924
924 #if defined(OS_MACOSX) 925 #if defined(OS_MACOSX)
925 BrowserCompositorMac::DisableRecyclingForShutdown(); 926 BrowserCompositorMac::DisableRecyclingForShutdown();
926 #endif 927 #endif
927 928
928 #if defined(USE_AURA) || defined(OS_MACOSX) 929 #if defined(USE_AURA) || defined(OS_MACOSX)
929 { 930 {
930 TRACE_EVENT0("shutdown", 931 TRACE_EVENT0("shutdown",
931 "BrowserMainLoop::Subsystem:ImageTransportFactory"); 932 "BrowserMainLoop::Subsystem:ImageTransportFactory");
932 ImageTransportFactory::Terminate(); 933 ImageTransportFactory::Terminate();
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 1352
1352 void BrowserMainLoop::EndStartupTracing() { 1353 void BrowserMainLoop::EndStartupTracing() {
1353 is_tracing_startup_ = false; 1354 is_tracing_startup_ = false;
1354 TracingController::GetInstance()->DisableRecording( 1355 TracingController::GetInstance()->DisableRecording(
1355 TracingController::CreateFileSink( 1356 TracingController::CreateFileSink(
1356 startup_trace_file_, 1357 startup_trace_file_,
1357 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1358 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1358 } 1359 }
1359 1360
1360 } // namespace content 1361 } // namespace content
OLDNEW
« base/mac/memory_pressure_monitor.cc ('K') | « content/browser/browser_main_loop.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698