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

Side by Side Diff: ui/gfx/win/singleton_hwnd_observer.h

Issue 1092183005: Fix Up SingletonHwnd Observer Lifetime Issues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert to scoped_ptr Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
sky 2015/04/28 13:20:34 nit: no (c) (see style guide).
robliao 2015/04/28 14:11:55 That presubmit check needs to be fixed. Done here.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_GFX_WIN_SINGLETON_HWND_OBSERVER_H_
6 #define UI_GFX_WIN_SINGLETON_HWND_OBSERVER_H_
7
8 #include <windows.h>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "ui/gfx/gfx_export.h"
13
14 namespace gfx {
15
16 class SingletonHwnd;
17
18 // Singleton lifetime management is tricky. This observer handles the correct
19 // cleanup if either the SingletonHwnd or forwarded object is destroyed first.
20 class GFX_EXPORT SingletonHwndObserver {
21 public:
22 typedef base::Callback<void(HWND, UINT, WPARAM, LPARAM)> WndProc;
23
24 explicit SingletonHwndObserver(const WndProc& wnd_proc);
25 ~SingletonHwndObserver();
26
27 private:
28 friend class SingletonHwnd;
29
30 void ClearWndProc();
31 void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
32
33 WndProc wnd_proc_;
34
35 DISALLOW_COPY_AND_ASSIGN(SingletonHwndObserver);
36 };
37
38 } // namespace gfx
39
40 #endif // UI_GFX_WIN_SINGLETON_HWND_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698