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

Issue 1092183005: Fix Up SingletonHwnd Observer Lifetime Issues (Closed)

Created:
5 years, 8 months ago by robliao
Modified:
5 years, 7 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, darin-cc_chromium.org, jam, derat+watch_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix Up SingletonHwnd Observer Lifetime Issues In preparation for handling session change notifications (WTSRegisterSessionNotification), SingletonHwnd needs to correctly destroy its own hwnd on destruction and all observers need to be able to handle that. This delta refactors SingletonHwnd::Observer to be a helper class and only way to listen for window messages from the SingletonHwnd. It also handles cleanup for both the observer and the SingletonHwnd if either is destroyed first. BUG=477462 Committed: https://crrev.com/305070a07d3dc2a18c01a9d3cd9e5d12e29e875d Cr-Commit-Position: refs/heads/master@{#328017}

Patch Set 1 #

Total comments: 14

Patch Set 2 : CR Feedback #

Patch Set 3 : Convert to scoped_ptr #

Total comments: 20

Patch Set 4 : CR Feedback #

Patch Set 5 : Removed WndProc null guard #

Total comments: 4

Patch Set 6 : CR Feedback #

Patch Set 7 : Quick Clean Up #

Patch Set 8 : Rebase to 9449f96 #

Patch Set 9 : Allow null SingletonHwnd Hwnd #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+169 lines, -91 lines) Patch
M chrome/browser/extensions/global_shortcut_listener_win.h View 1 2 3 4 5 6 7 2 chunks +7 lines, -8 lines 0 comments Download
M chrome/browser/extensions/global_shortcut_listener_win.cc View 1 2 3 4 5 2 chunks +7 lines, -2 lines 0 comments Download
M content/browser/time_zone_monitor_win.cc View 1 2 3 4 5 6 7 2 chunks +15 lines, -15 lines 0 comments Download
M ui/gfx/BUILD.gn View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gfx/font_render_params_win.cc View 1 2 3 4 5 4 chunks +11 lines, -12 lines 0 comments Download
M ui/gfx/gfx.gyp View 1 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gfx/screen_win.h View 1 2 3 4 5 3 chunks +7 lines, -9 lines 0 comments Download
M ui/gfx/screen_win.cc View 1 2 3 4 5 2 chunks +6 lines, -6 lines 0 comments Download
M ui/gfx/sys_color_change_listener.cc View 1 2 3 4 5 4 chunks +12 lines, -12 lines 2 comments Download
M ui/gfx/win/singleton_hwnd.h View 1 2 3 2 chunks +9 lines, -16 lines 0 comments Download
M ui/gfx/win/singleton_hwnd.cc View 1 2 3 4 5 6 7 8 3 chunks +16 lines, -11 lines 0 comments Download
A ui/gfx/win/singleton_hwnd_observer.h View 1 2 3 1 chunk +40 lines, -0 lines 0 comments Download
A ui/gfx/win/singleton_hwnd_observer.cc View 1 2 3 4 5 6 7 8 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 62 (25 generated)
robliao
5 years, 8 months ago (2015-04-24 18:04:33 UTC) #2
sky
https://codereview.chromium.org/1092183005/diff/1/chrome/browser/extensions/global_shortcut_listener_win.h File chrome/browser/extensions/global_shortcut_listener_win.h (right): https://codereview.chromium.org/1092183005/diff/1/chrome/browser/extensions/global_shortcut_listener_win.h#newcode41 chrome/browser/extensions/global_shortcut_listener_win.h:41: gfx::SingletonHwnd::Observer singletonHwndObserver_; singleton_hwnd_observer_ https://codereview.chromium.org/1092183005/diff/1/content/browser/time_zone_monitor_win.cc File content/browser/time_zone_monitor_win.cc (right): https://codereview.chromium.org/1092183005/diff/1/content/browser/time_zone_monitor_win.cc#newcode34 content/browser/time_zone_monitor_win.cc:34: ...
5 years, 8 months ago (2015-04-24 20:58:23 UTC) #3
robliao
https://codereview.chromium.org/1092183005/diff/1/chrome/browser/extensions/global_shortcut_listener_win.h File chrome/browser/extensions/global_shortcut_listener_win.h (right): https://codereview.chromium.org/1092183005/diff/1/chrome/browser/extensions/global_shortcut_listener_win.h#newcode41 chrome/browser/extensions/global_shortcut_listener_win.h:41: gfx::SingletonHwnd::Observer singletonHwndObserver_; On 2015/04/24 20:58:23, sky wrote: > singleton_hwnd_observer_ ...
5 years, 8 months ago (2015-04-24 21:49:03 UTC) #6
sky
https://codereview.chromium.org/1092183005/diff/1/ui/gfx/win/singleton_hwnd.cc File ui/gfx/win/singleton_hwnd.cc (right): https://codereview.chromium.org/1092183005/diff/1/ui/gfx/win/singleton_hwnd.cc#newcode20 ui/gfx/win/singleton_hwnd.cc:20: if (wndProc_.is_null()) On 2015/04/24 21:49:03, robliao wrote: > On ...
5 years, 8 months ago (2015-04-27 15:11:28 UTC) #7
robliao
https://codereview.chromium.org/1092183005/diff/1/ui/gfx/win/singleton_hwnd.cc File ui/gfx/win/singleton_hwnd.cc (right): https://codereview.chromium.org/1092183005/diff/1/ui/gfx/win/singleton_hwnd.cc#newcode20 ui/gfx/win/singleton_hwnd.cc:20: if (wndProc_.is_null()) On 2015/04/27 15:11:28, sky wrote: > On ...
5 years, 8 months ago (2015-04-27 22:45:46 UTC) #9
sky
Two more questions: . I believe you need to update BUILD.gn for the new files. ...
5 years, 7 months ago (2015-04-28 13:20:34 UTC) #10
robliao
On 2015/04/28 13:20:34, sky wrote: > Two more questions: > . I believe you need ...
5 years, 7 months ago (2015-04-28 14:11:49 UTC) #11
robliao
https://codereview.chromium.org/1092183005/diff/100001/chrome/browser/extensions/global_shortcut_listener_win.cc File chrome/browser/extensions/global_shortcut_listener_win.cc (right): https://codereview.chromium.org/1092183005/diff/100001/chrome/browser/extensions/global_shortcut_listener_win.cc#newcode43 chrome/browser/extensions/global_shortcut_listener_win.cc:43: &GlobalShortcutListenerWin::OnHotkey, base::Unretained(this)))); On 2015/04/28 13:20:34, sky wrote: > You ...
5 years, 7 months ago (2015-04-28 14:11:55 UTC) #12
robliao
https://codereview.chromium.org/1092183005/diff/100001/chrome/browser/extensions/global_shortcut_listener_win.cc File chrome/browser/extensions/global_shortcut_listener_win.cc (right): https://codereview.chromium.org/1092183005/diff/100001/chrome/browser/extensions/global_shortcut_listener_win.cc#newcode43 chrome/browser/extensions/global_shortcut_listener_win.cc:43: &GlobalShortcutListenerWin::OnHotkey, base::Unretained(this)))); On 2015/04/28 14:11:55, robliao wrote: > On ...
5 years, 7 months ago (2015-04-28 14:12:38 UTC) #13
sky
On Tue, Apr 28, 2015 at 7:11 AM, <robliao@chromium.org> wrote: > On 2015/04/28 13:20:34, sky ...
5 years, 7 months ago (2015-04-28 16:42:44 UTC) #14
sky
On 2015/04/28 14:12:38, robliao wrote: > https://codereview.chromium.org/1092183005/diff/100001/chrome/browser/extensions/global_shortcut_listener_win.cc > File chrome/browser/extensions/global_shortcut_listener_win.cc (right): > > https://codereview.chromium.org/1092183005/diff/100001/chrome/browser/extensions/global_shortcut_listener_win.cc#newcode43 > ...
5 years, 7 months ago (2015-04-28 16:43:37 UTC) #15
sky
https://codereview.chromium.org/1092183005/diff/100001/ui/gfx/win/singleton_hwnd_observer.cc File ui/gfx/win/singleton_hwnd_observer.cc (right): https://codereview.chromium.org/1092183005/diff/100001/ui/gfx/win/singleton_hwnd_observer.cc#newcode18 ui/gfx/win/singleton_hwnd_observer.cc:18: ClearWndProc(); On 2015/04/28 14:11:55, robliao wrote: > On 2015/04/28 ...
5 years, 7 months ago (2015-04-28 16:45:46 UTC) #16
robliao
On 2015/04/28 16:45:46, sky wrote: > https://codereview.chromium.org/1092183005/diff/100001/ui/gfx/win/singleton_hwnd_observer.cc > File ui/gfx/win/singleton_hwnd_observer.cc (right): > > https://codereview.chromium.org/1092183005/diff/100001/ui/gfx/win/singleton_hwnd_observer.cc#newcode18 > ...
5 years, 7 months ago (2015-04-28 22:02:17 UTC) #17
robliao
https://codereview.chromium.org/1092183005/diff/100001/ui/gfx/win/singleton_hwnd_observer.cc File ui/gfx/win/singleton_hwnd_observer.cc (right): https://codereview.chromium.org/1092183005/diff/100001/ui/gfx/win/singleton_hwnd_observer.cc#newcode32 ui/gfx/win/singleton_hwnd_observer.cc:32: if (wnd_proc_.is_null()) On 2015/04/28 16:45:46, sky wrote: > Shouldn't ...
5 years, 7 months ago (2015-04-28 22:14:10 UTC) #18
sky
I would argue they all should have a comment. On Tue, Apr 28, 2015 at ...
5 years, 7 months ago (2015-04-28 23:31:38 UTC) #19
sky
https://codereview.chromium.org/1092183005/diff/140001/ui/gfx/font_render_params_win.cc File ui/gfx/font_render_params_win.cc (right): https://codereview.chromium.org/1092183005/diff/140001/ui/gfx/font_render_params_win.cc#newcode89 ui/gfx/font_render_params_win.cc:89: void OnSettingsChange(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) ...
5 years, 7 months ago (2015-04-28 23:35:04 UTC) #20
robliao
https://codereview.chromium.org/1092183005/diff/140001/ui/gfx/font_render_params_win.cc File ui/gfx/font_render_params_win.cc (right): https://codereview.chromium.org/1092183005/diff/140001/ui/gfx/font_render_params_win.cc#newcode89 ui/gfx/font_render_params_win.cc:89: void OnSettingsChange(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) ...
5 years, 7 months ago (2015-04-29 00:25:43 UTC) #21
robliao
5 years, 7 months ago (2015-04-29 09:43:51 UTC) #22
sky
LGTM
5 years, 7 months ago (2015-04-29 15:28:23 UTC) #23
robliao
sievers@chromium.org: Please review changes in content/browser/time_zone_monitor_win.cc Thanks!
5 years, 7 months ago (2015-04-29 22:00:54 UTC) #25
no sievers
On 2015/04/29 22:00:54, robliao wrote: > mailto:sievers@chromium.org: Please review changes in > content/browser/time_zone_monitor_win.cc > lgtm
5 years, 7 months ago (2015-04-30 18:38:02 UTC) #26
robliao
Rebased to 9449f96
5 years, 7 months ago (2015-05-01 00:13:42 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1092183005/200001
5 years, 7 months ago (2015-05-01 00:15:07 UTC) #30
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1092183005/220001
5 years, 7 months ago (2015-05-01 02:59:31 UTC) #34
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1092183005/240001
5 years, 7 months ago (2015-05-01 03:06:14 UTC) #39
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1092183005/260001
5 years, 7 months ago (2015-05-01 03:13:13 UTC) #44
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1092183005/280001
5 years, 7 months ago (2015-05-01 08:04:09 UTC) #49
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 7 months ago (2015-05-01 08:50:16 UTC) #51
robliao
On 2015/05/01 08:50:16, I haz the power (commit-bot) wrote: > Dry run: This issue passed ...
5 years, 7 months ago (2015-05-01 08:57:15 UTC) #52
sky
Did you investigate why there is no hwnd for those tests?
5 years, 7 months ago (2015-05-01 15:17:56 UTC) #53
robliao
On 2015/05/01 15:17:56, sky wrote: > Did you investigate why there is no hwnd for ...
5 years, 7 months ago (2015-05-01 15:33:00 UTC) #54
sky
Fair enough, LGTM
5 years, 7 months ago (2015-05-01 18:16:08 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1092183005/280001
5 years, 7 months ago (2015-05-01 23:36:39 UTC) #57
commit-bot: I haz the power
Committed patchset #9 (id:280001)
5 years, 7 months ago (2015-05-01 23:47:29 UTC) #58
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/305070a07d3dc2a18c01a9d3cd9e5d12e29e875d Cr-Commit-Position: refs/heads/master@{#328017}
5 years, 7 months ago (2015-05-01 23:48:28 UTC) #59
Alexei Svitkine (slow)
https://codereview.chromium.org/1092183005/diff/280001/ui/gfx/sys_color_change_listener.cc File ui/gfx/sys_color_change_listener.cc (right): https://codereview.chromium.org/1092183005/diff/280001/ui/gfx/sys_color_change_listener.cc#newcode71 ui/gfx/sys_color_change_listener.cc:71: scoped_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_; Drive-by: Is there a reason these members ...
5 years, 7 months ago (2015-05-04 15:44:29 UTC) #61
robliao
5 years, 7 months ago (2015-05-04 17:03:12 UTC) #62
Message was sent while issue was closed.
https://codereview.chromium.org/1092183005/diff/280001/ui/gfx/sys_color_chang...
File ui/gfx/sys_color_change_listener.cc (right):

https://codereview.chromium.org/1092183005/diff/280001/ui/gfx/sys_color_chang...
ui/gfx/sys_color_change_listener.cc:71: scoped_ptr<gfx::SingletonHwndObserver>
singleton_hwnd_observer_;
On 2015/05/04 15:44:29, Alexei Svitkine wrote:
> Drive-by:
> 
> Is there a reason these members are scoped_ptrs rather than direct members?
> Seems the latter should be sufficient.

See
https://codereview.chromium.org/1092183005/#msg7 for the discussion.

Powered by Google App Engine
This is Rietveld 408576698