diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-02 15:12:59 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-02 15:12:59 +0000 |
commit | 2dd68fd375448e951f5476f0de313b6551d9a785 (patch) | |
tree | 59764834be4e89d4d8e715fa1cf3b4a73c53a915 /base/power_monitor | |
parent | 0ed307aca2af5b12705d7a2d8c749bd73f7d9947 (diff) | |
download | chromium_src-2dd68fd375448e951f5476f0de313b6551d9a785.zip chromium_src-2dd68fd375448e951f5476f0de313b6551d9a785.tar.gz chromium_src-2dd68fd375448e951f5476f0de313b6551d9a785.tar.bz2 |
Fix blocking of shutdown on Windows
Some code was creating windows in the renderer process. These windows are
included in Windows' enumeration of a renderer's threads at log off/shutdown.
Renderers do not have a UI message loop (aren't pumped) and so don't respond
to messages that Windows sends during shutdown. As a result, they appear hung,
and shutdown is blocked.
Remove two locations that were creating windows, and add a DCHECK that the
main renderer thread does not create windows.
BUG=230122,236031,236039
Review URL: https://chromiumcodereview.appspot.com/14305025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/power_monitor')
-rw-r--r-- | base/power_monitor/power_monitor_win.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/power_monitor/power_monitor_win.cc b/base/power_monitor/power_monitor_win.cc index 67a6ce1..156ee2b 100644 --- a/base/power_monitor/power_monitor_win.cc +++ b/base/power_monitor/power_monitor_win.cc @@ -27,6 +27,13 @@ bool PowerMonitor::IsBatteryPower() { PowerMonitor::PowerMessageWindow::PowerMessageWindow() : instance_(NULL), message_hwnd_(NULL) { + if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) { + // Creating this window in (e.g.) a renderer inhibits shutdown on Windows. + // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031 + DLOG(ERROR) + << "Cannot create windows on non-UI thread, power monitor disabled!"; + return; + } WNDCLASSEX window_class; base::win::InitializeWindowClass( kWindowClassName, |