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

Side by Side Diff: ui/gfx/win/singleton_hwnd.cc

Issue 2286943002: Remove confusing DLOG from SingletonHwnd (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gfx/win/singleton_hwnd.h" 5 #include "ui/gfx/win/singleton_hwnd.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "ui/gfx/win/singleton_hwnd_observer.h" 9 #include "ui/gfx/win/singleton_hwnd_observer.h"
10 10
(...skipping 13 matching lines...) Expand all
24 FOR_EACH_OBSERVER(SingletonHwndObserver, 24 FOR_EACH_OBSERVER(SingletonHwndObserver,
25 observer_list_, 25 observer_list_,
26 OnWndProc(window, message, wparam, lparam)); 26 OnWndProc(window, message, wparam, lparam));
27 return false; 27 return false;
28 } 28 }
29 29
30 SingletonHwnd::SingletonHwnd() { 30 SingletonHwnd::SingletonHwnd() {
31 if (!base::MessageLoopForUI::IsCurrent()) { 31 if (!base::MessageLoopForUI::IsCurrent()) {
32 // Creating this window in (e.g.) a renderer inhibits shutdown on 32 // Creating this window in (e.g.) a renderer inhibits shutdown on
33 // Windows. See http://crbug.com/230122 and http://crbug.com/236039. 33 // Windows. See http://crbug.com/230122 and http://crbug.com/236039.
34 DLOG(ERROR) << "Cannot create windows on non-UI thread!";
Nico 2016/08/26 21:21:37 could this be a CHECK?
scottmg 2016/08/26 21:24:00 No :( happens all the time (currently) in poorly f
35 return; 34 return;
36 } 35 }
37 WindowImpl::Init(NULL, Rect()); 36 WindowImpl::Init(NULL, Rect());
38 } 37 }
39 38
40 SingletonHwnd::~SingletonHwnd() { 39 SingletonHwnd::~SingletonHwnd() {
41 // WindowImpl will clean up the hwnd value on WM_NCDESTROY. 40 // WindowImpl will clean up the hwnd value on WM_NCDESTROY.
42 if (hwnd()) 41 if (hwnd())
43 DestroyWindow(hwnd()); 42 DestroyWindow(hwnd());
44 43
45 // Tell all of our current observers to clean themselves up. 44 // Tell all of our current observers to clean themselves up.
46 FOR_EACH_OBSERVER(SingletonHwndObserver, observer_list_, ClearWndProc()); 45 FOR_EACH_OBSERVER(SingletonHwndObserver, observer_list_, ClearWndProc());
47 } 46 }
48 47
49 void SingletonHwnd::AddObserver(SingletonHwndObserver* observer) { 48 void SingletonHwnd::AddObserver(SingletonHwndObserver* observer) {
50 observer_list_.AddObserver(observer); 49 observer_list_.AddObserver(observer);
51 } 50 }
52 51
53 void SingletonHwnd::RemoveObserver(SingletonHwndObserver* observer) { 52 void SingletonHwnd::RemoveObserver(SingletonHwndObserver* observer) {
54 observer_list_.RemoveObserver(observer); 53 observer_list_.RemoveObserver(observer);
55 } 54 }
56 55
57 } // namespace gfx 56 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698