diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-27 13:16:54 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-27 13:16:54 +0000 |
commit | 4643342df1a699719c5c900f91d789d2f8105764 (patch) | |
tree | d94c26230d70fbaef735b2b83170550f11242600 /chrome/app/chrome_main.cc | |
parent | ebd19b7213b2b1242ef9874013a5e72d4e6530fb (diff) | |
download | chromium_src-4643342df1a699719c5c900f91d789d2f8105764.zip chromium_src-4643342df1a699719c5c900f91d789d2f8105764.tar.gz chromium_src-4643342df1a699719c5c900f91d789d2f8105764.tar.bz2 |
[Mac] Make Chrome not delay system sleep
Some processes [e.g. the GPU process] do not set up a SystemMonitor object, since the startup code was changed to always allocate the Power notification IO port [http://codereview.chromium.org/7235023/] these processes were causing a delay in sleep as the power manager was trying to contact the process.
This change whitelists the IO port allocation in ChromeMain() to only include process types that allocate a SystemMonitor which fixes the sleep issue.
If a process not in the whitelist attempts to use the SystemMonitor it will hit a DCHECK in a debug build and the error will be ignored in release (see SystemMonitor::PlatformInit()).
BUG=88867
TEST=When Chrome is running, Macs should sleep immediately.
Review URL: http://codereview.chromium.org/7491038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94279 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/chrome_main.cc')
-rw-r--r-- | chrome/app/chrome_main.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc index 0e9aa0f..d713df2 100644 --- a/chrome/app/chrome_main.cc +++ b/chrome/app/chrome_main.cc @@ -69,6 +69,7 @@ #include "grit/chromium_strings.h" #include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.h" #include "ui/base/l10n/l10n_util_mac.h" +#include "ui/base/l10n/l10n_util.h" #endif #if defined(OS_POSIX) @@ -587,10 +588,6 @@ int ChromeMain(int argc, char** argv) { #if defined(OS_MACOSX) chrome_main::SetUpBundleOverrides(); - - // We need to allocate the IO Ports before the Sandbox is initialized or - // the first instance of SystemMonitor is created. - base::SystemMonitor::AllocateSystemIOPorts(); #endif CommandLine::Init(argc, argv); @@ -622,6 +619,22 @@ int ChromeMain(int argc, char** argv) { return 1; #endif +#if defined(OS_MACOSX) + // We need to allocate the IO Ports before the Sandbox is initialized or + // the first instance of SystemMonitor is created. + // It's important not to allocate the ports for processes which don't register + // with the system monitor - see crbug.com/88867. + if (process_type.empty() || + process_type == switches::kExtensionProcess || + process_type == switches::kNaClLoaderProcess || + process_type == switches::kPluginProcess || + process_type == switches::kRendererProcess || + process_type == switches::kUtilityProcess || + process_type == switches::kWorkerProcess) { + base::SystemMonitor::AllocateSystemIOPorts(); + } +#endif + base::ProcessId browser_pid = base::GetCurrentProcId(); if (SubprocessIsBrowserChild(process_type)) { #if defined(OS_WIN) || defined(OS_MACOSX) |