| 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..c24579d2f6a8f3520c41eff542255a89ef265301 100644
|
| --- a/ui/gfx/win/singleton_hwnd.cc
|
| +++ b/ui/gfx/win/singleton_hwnd.cc
|
| @@ -14,17 +14,20 @@ SingletonHwnd* SingletonHwnd::GetInstance() {
|
| return Singleton<SingletonHwnd>::get();
|
| }
|
|
|
| -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());
|
| +void SingletonHwnd::Init() {
|
| + 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());
|
| +}
|
| +
|
| +void SingletonHwnd::AddObserver(Observer* observer) {
|
| + if (!hwnd())
|
| + Init();
|
| observer_list_.AddObserver(observer);
|
| }
|
|
|
|
|