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

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