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
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget: Win32 (show other bugs)
: Trunk
: x86_64 Windows 7
: -- normal (vote)
: mozilla9
Assigned To: Brian R. Bondy [:bbondy]
:
Mentors:
Depends on:
Blocks:
  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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch for calling nsISound (1.69 KB, patch)
2011-08-30 19:40 PDT, Brian R. Bondy [:bbondy]
jmathies: review+
Details | Diff | 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:

http://mxr.mozilla.org/mozilla-central/source/widget/src/windows/nsWindow.cpp#6140

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:
https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=38dc50c1c180
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:
http://hg.mozilla.org/integration/mozilla-inbound/rev/9401940db9d2
Comment 8 :Ehsan Akhgari (busy, don't ask for review please) 2011-09-08 14:04:43 PDT
http://hg.mozilla.org/mozilla-central/rev/9401940db9d2

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