Bug 1247189 - part5 : use IsCurrentThreadIn() as a main criteria to determine whether we're on the task queue or not. draft
authorAlastor Wu <alwu@mozilla.com>
Thu, 12 Oct 2017 10:49:25 +0800
changeset 678944 0bfa107c84a4dcf72517cb5ffd9f192827143d30
parent 678943 57e7a9b93609665e7fba4f0815842028c56dff41
child 735471 71acbe59238fa9f9757c7ea8694696387baf666e
push id84076
push useralwu@mozilla.com
push dateThu, 12 Oct 2017 02:49:38 +0000
bugs1247189
milestone58.0a1
Bug 1247189 - part5 : use IsCurrentThreadIn() as a main criteria to determine whether we're on the task queue or not. The use of the TrackBuffersManager once detached is explictly forbidden, as such OnTaskQueue() can only be used before the DetachTask ran: we now strongly assert as such. MozReview-Commit-ID: ycOI4QRElb
dom/media/mediasource/TrackBuffersManager.h
--- a/dom/media/mediasource/TrackBuffersManager.h
+++ b/dom/media/mediasource/TrackBuffersManager.h
@@ -456,17 +456,18 @@ private:
 
   // TaskQueue methods and objects.
   AbstractThread* GetTaskQueue() const
   {
     return mTaskQueue;
   }
   bool OnTaskQueue() const
   {
-    return !GetTaskQueue() || GetTaskQueue()->IsCurrentThreadIn();
+    MOZ_RELEASE_ASSERT(GetTaskQueue());
+    return GetTaskQueue()->IsCurrentThreadIn();
   }
   RefPtr<AutoTaskQueue> mTaskQueue;
 
   // SourceBuffer Queues and running context.
   SourceBufferTaskQueue mQueue;
   void QueueTask(SourceBufferTask* aTask);
   void ProcessTasks();
   // Set if the TrackBuffersManager is currently processing a task.