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

Unified Diff: ui/gfx/screen_win.cc

Issue 1092183005: Fix Up SingletonHwnd Observer Lifetime Issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow null SingletonHwnd Hwnd Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/screen_win.cc
diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc
index 9210971d7b45d63865c6de2dd1dc0f2a9c75d7e1..f19117b80f8ffa9c2105880f5b21a1a2b2da3879 100644
--- a/ui/gfx/screen_win.cc
+++ b/ui/gfx/screen_win.cc
@@ -6,6 +6,8 @@
#include <windows.h>
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/hash.h"
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
@@ -85,13 +87,11 @@ std::vector<gfx::Display> GetDisplays() {
namespace gfx {
ScreenWin::ScreenWin()
- : displays_(GetDisplays()) {
- SingletonHwnd::GetInstance()->AddObserver(this);
-}
+ : displays_(GetDisplays()),
+ singleton_hwnd_observer_(new SingletonHwndObserver(
+ base::Bind(&ScreenWin::OnWndProc, base::Unretained(this)))) {}
-ScreenWin::~ScreenWin() {
- SingletonHwnd::GetInstance()->RemoveObserver(this);
-}
+ScreenWin::~ScreenWin() {}
gfx::Point ScreenWin::GetCursorScreenPoint() {
POINT pt;

Powered by Google App Engine
This is Rietveld 408576698