Last Comment Bug 683188 - nsISound should be used in Win32 widget code, not PlaySound directly
: nsISound should be used in Win32 widget code, not PlaySound directly
Product: Core
Classification: Components
Component: Widget: Win32 (show other bugs)
: Trunk
: x86_64 Windows 7
: -- normal (vote)
: mozilla9
Assigned To: Brian R. Bondy [:bbondy]
: Jim Mathies [:jimm]
Depends on:
  Show dependency treegraph
Reported: 2011-08-30 09:32 PDT by Brian R. Bondy [:bbondy]
Modified: 2011-09-08 14:04 PDT (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch for calling nsISound (1.69 KB, patch)
2011-08-30 19:40 PDT, Brian R. Bondy [:bbondy]
jmathies: review+
Details | Diff | Splinter Review

Description Brian R. Bondy [:bbondy] 2011-08-30 09:32:17 PDT
We are currently calling PlaySound directly in widget/src/wimndows/nsWindow.cpp here:

The problem with this is that Win32's ASYNC flag isn't exactly async. This may slow down or seem to temporarily hang some computers that minimize.  Instead we should be using nsISound which has support for this via threading.
Comment 1 Brian R. Bondy [:bbondy] 2011-08-30 09:34:17 PDT
Regarding the problem mentioned with Win32's ASYNC flag, please see Bug 498079
Comment 2 Brian R. Bondy [:bbondy] 2011-08-30 19:40:08 PDT
Created attachment 557078 [details] [diff] [review]
Patch for calling nsISound
Comment 3 Jim Mathies [:jimm] 2011-09-07 07:43:26 PDT
Comment on attachment 557078 [details] [diff] [review]
Patch for calling nsISound

We should probably cache sound so we only have to create it once.
Comment 4 Brian R. Bondy [:bbondy] 2011-09-07 07:44:39 PDT
We are currently doing that everywhere we play sound. 
Bug 683184 will address this by making it a service. 
So is it OK as is until Bug 683184?
Comment 5 Brian R. Bondy [:bbondy] 2011-09-07 10:21:32 PDT
Pushed to try:
Comment 6 Brian R. Bondy [:bbondy] 2011-09-07 10:22:06 PDT
Jim mentioned that Comment 4 sounded good by the way on irc.
Comment 7 Brian R. Bondy [:bbondy] 2011-09-08 08:26:24 PDT
Pushed to mozilla-inbound:

Note You need to log in before you can comment on or make changes to this bug.