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

Unified Diff: ui/views/win/hwnd_message_handler.h

Issue 1107353003: win: Move HWNDMessageHandler's WeakPtrFactory member to the end. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.h
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index a966eae21a1eeb988dc72bc34816829c4b86b693..0a1a147df2031d0dff62755537b5305a75873de2 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -55,16 +55,15 @@ const int WM_NCUAHDRAWCAPTION = 0xAE;
const int WM_NCUAHDRAWFRAME = 0xAF;
// IsMsgHandled() and BEGIN_SAFE_MSG_MAP_EX are a modified version of
-// BEGIN_MSG_MAP_EX. The main difference is it adds a WeakPtrFactory member
-// (|weak_factory_|) that is used in _ProcessWindowMessage() and changing
+// BEGIN_MSG_MAP_EX. The main difference is it uses a WeakPtrFactory member
+// (|weak_factory|) that is used in _ProcessWindowMessage() and changing
// IsMsgHandled() from a member function to a define that checks if the weak
// factory is still valid in addition to the member. Together these allow for
// |this| to be deleted during dispatch.
#define IsMsgHandled() !ref.get() || msg_handled_
-#define BEGIN_SAFE_MSG_MAP_EX(the_class) \
+#define BEGIN_SAFE_MSG_MAP_EX(weak_factory) \
private: \
- base::WeakPtrFactory<the_class> weak_factory_; \
BOOL msg_handled_; \
\
public: \
@@ -78,7 +77,7 @@ const int WM_NCUAHDRAWFRAME = 0xAF;
LPARAM l_param, \
LRESULT& l_result, \
DWORD msg_map_id = 0) { \
- base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
+ base::WeakPtr<HWNDMessageHandler> ref(weak_factory.GetWeakPtr()); \
BOOL old_msg_handled = msg_handled_; \
BOOL ret = _ProcessWindowMessage(hwnd, msg, w_param, l_param, l_result, \
msg_map_id); \
@@ -92,7 +91,7 @@ const int WM_NCUAHDRAWFRAME = 0xAF;
LPARAM lParam, \
LRESULT& lResult, \
DWORD dwMsgMapID) { \
- base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); \
+ base::WeakPtr<HWNDMessageHandler> ref(weak_factory.GetWeakPtr()); \
BOOL bHandled = TRUE; \
hWnd; \
uMsg; \
@@ -315,7 +314,7 @@ class VIEWS_EXPORT HWNDMessageHandler :
// Message Handlers ----------------------------------------------------------
- BEGIN_SAFE_MSG_MAP_EX(HWNDMessageHandler)
+ BEGIN_SAFE_MSG_MAP_EX(weak_factory_)
// Range handlers must go first!
CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE,
@@ -627,6 +626,8 @@ class VIEWS_EXPORT HWNDMessageHandler :
// glass. Defaults to false.
bool dwm_transition_desired_;
+ base::WeakPtrFactory<HWNDMessageHandler> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler);
};
« no previous file with comments | « no previous file | ui/views/win/hwnd_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698