Closed
Bug 1188269
Opened 9 years ago
Closed 4 years ago
Create AudioShutdownManager to manage the lifetime of different AudioSinks.
Categories
(Core :: Audio/Video: Playback, defect, P3)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
INVALID
People
(Reporter: kikuo, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
8.22 KB,
patch
|
Details | Diff | Splinter Review |
Per Bug 1146795 Comment 30, Bug 1146795 Comment 32, Create an AudioShutdownManager, and enforce new instantiated AudioSink to register to it. So that AudioSink Shutdown API could be asynchronized inside itself, and once the process accomplished, AudioShutdownManager could do AudioSink destruction.
Reporter | ||
Comment 1•9 years ago
|
||
Hi JW, I created a MediaSinkShutdownManager to make AudioSink::Shutdown() asynchronized inside AudioSink. This pattern could be useful once other MediaSinks take more time for shutdown themselves. But right now, it's not high priority. Several thoughts about the machinery, First, I was thinking shutting down this manager by listening to this topic "NS_XPCOM_SHUTDOWN_OBSERVER_ID", but in this case, MediaSinkShutdownManager will be idle most of the time. Also registering MediaSinkShutdownManager to observerservice needs to be done in main thread. But we only need to create this manager once there's a mediasink needs to be destroyed and it needn't to happen in main thread. So I discarded this practice. Second, To reduce the complexity, I'm not trying to provide API to get the static instance pointer, that's why I directly using "static" on DispatchXXX() & Shutdown(). Third, I've thought about utilizing thread in MedaiThreadPool to reduce the overhead of creating/terminating thread. Any thoughts ?
Attachment #8642922 -
Flags: feedback?(jwwang)
Comment 2•9 years ago
|
||
Comment on attachment 8642922 [details] [diff] [review] Add_MediaSinkShutdownManager_255041 Review of attachment 8642922 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/media/MediaSinkShutdownManager.cpp @@ +15,5 @@ > +MediaSinkShutdownManager::MediaSinkShutdownManager() > + : mRemainingTasks(0) > +{ > + MOZ_COUNT_CTOR(MediaSinkShutdownManager); > + nsresult rv = NS_NewNamedThread("MediaSinkMgr", Why not using TaskQueue? SharedThreadPool::SpinUntilEmpty will consume all pending tasks during shutdown. So you don't need MediaSinkShutdownManager::Shutdown() @@ +58,5 @@ > + nsCOMPtr<nsIRunnable> r = > + new MediaSinkShutdownManager::MediaSinkShutdownTask(Move(event)); > + DebugOnly<nsresult> rv = > + sInstance->mThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL); > + MOZ_ASSERT(NS_SUCCEEDED(rv)); You don't have to deal with the chore when using TaskQueue. ::: dom/media/MediaSinkShutdownManager.h @@ +6,5 @@ > + > +#if !defined(MediaSinkShutdownManager_h_) > +#define MediaSinkShutdownManager_h_ > + > +#include "mozilla/RefPtr.h" Prefer nsRefPtr over RefPtr. @@ +17,5 @@ > +class MediaSinkShutdownManager > +{ > +public: > + static void Shutdown(); > + static void DispatchShutdown(already_AddRefed<nsIRunnable>&& event); Use a singleton instead of static methods. See MediaShutdownManager.
Attachment #8642922 -
Flags: feedback?(jwwang)
Updated•9 years ago
|
Assignee: nobody → kikuo
Priority: -- → P2
Mass change P2 -> P3
Priority: P2 → P3
Reporter | ||
Updated•6 years ago
|
Assignee: kilik.kuo → nobody
Comment 4•4 years ago
|
||
This bug tries modify MediaSinkShutdownManager
which is no longer existing in our codebase, so close this bug.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•