Closed
Bug 1154782
Opened 9 years ago
Closed 9 years ago
Clean up AbstractThread dispatch semantics
Categories
(Core :: Audio/Video, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(5 files)
3.01 KB,
patch
|
jwwang
:
review+
|
Details | Diff | Splinter Review |
10.79 KB,
patch
|
jwwang
:
review+
|
Details | Diff | Splinter Review |
8.42 KB,
patch
|
jwwang
:
review+
|
Details | Diff | Splinter Review |
5.44 KB,
patch
|
jwwang
:
review+
|
Details | Diff | Splinter Review |
7.17 KB,
patch
|
jwwang
:
review+
|
Details | Diff | Splinter Review |
My branch for bug 1144486 is getting pretty long, so I'm separating out pieces that can land on their own. The main goals of this bug are to automate the assertion of dispatch success and streamline the API entry points on MediaTaskQueue.
Assignee | ||
Comment 1•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d53ed28bfb5e
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8593030 -
Flags: review?(jwwang)
Assignee | ||
Comment 3•9 years ago
|
||
This is nicer than scattering the failure handling to each callsite. Moreover, this is a necessary step on the road to automatic tail dispatch.
Attachment #8593031 -
Flags: review?(jwwang)
Assignee | ||
Comment 4•9 years ago
|
||
I added this several months ago to make MediaPromise dispatch reliable in the presence of the god-awful Flush() feature of MediaTaskQueue. That feature has now been restricted to a special subclass (which we should eventually eliminate), so we can just assert that MediaPromises are never used on those task queues and simplify the rest of the code.
Attachment #8593032 -
Flags: review?(jwwang)
Assignee | ||
Comment 5•9 years ago
|
||
We've been meaning to do this for a while, just haven't gotten around to it.
Attachment #8593033 -
Flags: review?(jwwang)
Assignee | ||
Comment 6•9 years ago
|
||
Most of the callers ignore the return values. The MOZ_DIAGNOSTIC_ASSERTS will tell us if any of these actually fail in practice.
Attachment #8593034 -
Flags: review?(jwwang)
Comment 7•9 years ago
|
||
Comment on attachment 8593034 [details] [diff] [review] Part 5 - Align the failure handling of the TemporaryRef Dispatch overload with its companion. v1 Review of attachment 8593034 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/media/fmp4/eme/EMEDecoderModule.cpp @@ +35,5 @@ > } > > virtual nsresult Init() override { > MOZ_ASSERT(!mIsShutdown); > + mTaskQueue->SyncDispatch(NS_NewRunnableMethod(mDecoder, &MediaDataDecoder::Init)); FYI, I removed the use of SyncDispatch() from EMEDecoderModule.cpp in bug 1154133, and alfredo is removing it from the Gonk PDM in bug 1154512. So soon we can remove MediaTaskQueue::SyncDispatch(). :)
Updated•9 years ago
|
Attachment #8593030 -
Flags: review?(jwwang) → review+
Updated•9 years ago
|
Attachment #8593031 -
Flags: review?(jwwang) → review+
Comment 8•9 years ago
|
||
Comment on attachment 8593032 [details] [diff] [review] Part 3 - Remove the concept of forced dispatch. v1 Review of attachment 8593032 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/media/MediaPromise.h @@ +320,5 @@ > // infrequently. > aDispatcher.AssertIsTailDispatcherIfRequired(); > > MutexAutoLock lock(mMutex); > + MOZ_ASSERT(aResponseThread->IsDispatchReliable()); Does this assertion mean MediaPromise should be used with reliable dispatcher only? ::: dom/media/MediaTaskQueue.h @@ +126,5 @@ > > // Monitor that protects the queue and mIsRunning; > Monitor mQueueMonitor; > > struct TaskQueueEntry { We can just get rid of this class which has a single member.
Attachment #8593032 -
Flags: review?(jwwang) → review+
Comment 9•9 years ago
|
||
Comment on attachment 8593033 [details] [diff] [review] Part 4 - Change the canonical internal smart pointer type in MediaTaskQueue to the XPCOM style. v1 Review of attachment 8593033 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/media/MediaTaskQueue.h @@ +40,5 @@ > static MediaTaskQueue* GetCurrentQueue() { return sCurrentQueueTLS.get(); } > > explicit MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool, bool aRequireTailDispatch = false); > > + nsresult Dispatch(TemporaryRef<nsIRunnable> aRunnable) Will this change to already_AddRefed<nsIRunnable>?
Attachment #8593033 -
Flags: review?(jwwang) → review+
Comment 10•9 years ago
|
||
Comment on attachment 8593034 [details] [diff] [review] Part 5 - Align the failure handling of the TemporaryRef Dispatch overload with its companion. v1 Review of attachment 8593034 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/media/MediaTaskQueue.cpp @@ +112,1 @@ > return task->WaitUntilDone(); It looks strange to me to return a void type. Does the coding guidelines talk about it?
Attachment #8593034 -
Flags: review?(jwwang) → review+
Assignee | ||
Comment 11•9 years ago
|
||
(In reply to JW Wang [:jwwang] from comment #8) > Does this assertion mean MediaPromise should be used with reliable > dispatcher only? Yes. > We can just get rid of this class which has a single member. Good catch.(In reply to JW Wang [:jwwang] from comment #9) > > + nsresult Dispatch(TemporaryRef<nsIRunnable> aRunnable) > > Will this change to already_AddRefed<nsIRunnable>? The point of this overload is to support all the legacy callers that pass RefPtrs rather than ns{COM,Ref}Ptrs. We should fix those at some point, but I wanted to keep this patch small-ish. (In reply to JW Wang [:jwwang] from comment #10) > ::: dom/media/MediaTaskQueue.cpp > @@ +112,1 @@ > > return task->WaitUntilDone(); > > It looks strange to me to return a void type. Does the coding guidelines > talk about it? Good catch - fixed.
Assignee | ||
Comment 12•9 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/86e83c1fbaea remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/4e9b6d32d83f remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/25d4f90ff250 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/178e696b5691 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/0651f3983932
Comment 13•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/86e83c1fbaea https://hg.mozilla.org/mozilla-central/rev/4e9b6d32d83f https://hg.mozilla.org/mozilla-central/rev/25d4f90ff250 https://hg.mozilla.org/mozilla-central/rev/178e696b5691 https://hg.mozilla.org/mozilla-central/rev/0651f3983932
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•