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

Issue 480503002: [Win] Battery Status API: use SingletonHwnd for notifications. (Closed)

Created:
6 years, 4 months ago by timvolodine
Modified:
6 years ago
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

[Win] Battery Status API: use SingletonHwnd for notifications. Use a singleton message-only window (SingletonHwnd) instead of creating a separate message window for receiving battery notifications. In addition to re-using the window, this simplifies some logic in BatteryStatusManagerObserver. BUG=404139

Patch Set 1 #

Patch Set 2 : added thread checker #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -59 lines) Patch
M content/browser/battery_status/battery_status_manager_win.cc View 1 5 chunks +43 lines, -58 lines 0 comments Download
M ui/gfx/win/singleton_hwnd.h View 1 2 chunks +2 lines, -0 lines 0 comments Download
M ui/gfx/win/singleton_hwnd.cc View 1 2 chunks +4 lines, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
timvolodine
6 years, 4 months ago (2014-08-15 15:29:10 UTC) #1
scottmg
Sorry, I missed this. SingletonHwnd has default traits on Singleton<> which seems to mean it ...
6 years, 3 months ago (2014-08-26 19:56:58 UTC) #2
cpu_(ooo_6.6-7.5)
lgtm
6 years, 3 months ago (2014-08-26 20:08:53 UTC) #3
timvolodine
6 years, 3 months ago (2014-09-01 11:55:57 UTC) #4
timvolodine
6 years, 3 months ago (2014-09-01 12:09:12 UTC) #5
On 2014/09/01 11:55:57, timvolodine wrote:

Actually SingletonHwnd AddObserver(), RemoveObserver() do not seem to be
thread-safe. Assuming that the current usage of SingletonHwnd is from the UI
thread (but I am not 100% sure), I've added a ThreadChecker for this, probably
better would be to use an explicit BrowserThread::UI check, but gfx does not
seem to link with content.. + also added a DLOG(FATAL) when created on non UI
thread.

After running the tests it appears the SingletonHwnd is actually created on
non-ui threads! (e.g. SysColorChangeObserver and CachedFontRenderParams). This
looks weird: why would we create a dummy singleton hwnd in those cases? Also
this isn't particularly encouraging regarding thread-safety..

Powered by Google App Engine
This is Rietveld 408576698