Index: ui/gfx/win/singleton_hwnd.cc |
diff --git a/ui/gfx/win/singleton_hwnd.cc b/ui/gfx/win/singleton_hwnd.cc |
index 37993e8f4f0fc05ec40fdca05020e6d55fef9a2d..2de6a8b8a1612d9fabbb6691b94c6499833e23a6 100644 |
--- a/ui/gfx/win/singleton_hwnd.cc |
+++ b/ui/gfx/win/singleton_hwnd.cc |
@@ -15,16 +15,6 @@ SingletonHwnd* SingletonHwnd::GetInstance() { |
} |
void SingletonHwnd::AddObserver(Observer* observer) { |
- if (!hwnd()) { |
- if (!base::MessageLoop::current() || |
- base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { |
- // Creating this window in (e.g.) a renderer inhibits shutdown on |
- // Windows. See http://crbug.com/230122 and http://crbug.com/236039. |
- DLOG(ERROR) << "Cannot create windows on non-UI thread!"; |
- return; |
- } |
- WindowImpl::Init(NULL, Rect()); |
- } |
observer_list_.AddObserver(observer); |
} |
@@ -47,6 +37,14 @@ BOOL SingletonHwnd::ProcessWindowMessage(HWND window, |
} |
SingletonHwnd::SingletonHwnd() { |
+ if (!base::MessageLoop::current() || |
+ base::MessageLoop::current()->type() != base::MessageLoop::TYPE_UI) { |
+ // Creating this window in (e.g.) a renderer inhibits shutdown on |
+ // Windows. See http://crbug.com/230122 and http://crbug.com/236039. |
+ DLOG(ERROR) << "Cannot create windows on non-UI thread!"; |
+ return; |
+ } |
+ WindowImpl::Init(NULL, Rect()); |
} |
SingletonHwnd::~SingletonHwnd() { |