Bug 1407549 - Make segments allocate chunk storage locally. r=padenot
authorAndreas Pehrson <pehrsons@mozilla.com>
Thu, 29 Mar 2018 16:13:36 +0200
changeset 411691 c9e04ecaaa463586021c69beb388020e52d88d5d
parent 411690 a95b0c5c8e9f6add090de2055d508e020805fbe1
child 411692 7204e90dce1a6922ccd48953a1b1baa6011d47fa
push id101729
push usercsabou@mozilla.com
push dateWed, 04 Apr 2018 18:07:35 +0000
treeherdermozilla-inbound@3c240f56a113 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1407549
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1407549 - Make segments allocate chunk storage locally. r=padenot MozReview-Commit-ID: 19VOLomq8A6
dom/media/MediaSegment.h
--- a/dom/media/MediaSegment.h
+++ b/dom/media/MediaSegment.h
@@ -444,22 +444,22 @@ public:
       return nullptr;
     }
     return &mChunks[mChunks.Length() - 1];
   }
 
 protected:
   explicit MediaSegmentBase(Type aType)
     : MediaSegment(aType)
-    , mChunks(DEFAULT_SEGMENT_CAPACITY)
+    , mChunks()
   {}
 
   MediaSegmentBase(MediaSegmentBase&& aSegment)
     : MediaSegment(Move(aSegment))
-    , mChunks(aSegment.mChunks.Capacity())
+    , mChunks()
 #ifdef MOZILLA_INTERNAL_API
     , mTimeStamp(Move(aSegment.mTimeStamp))
 #endif
   {
     mChunks.SwapElements(aSegment.mChunks);
     MOZ_ASSERT(mChunks.Capacity() >= DEFAULT_SEGMENT_CAPACITY,
                "Capacity must be retained in self after swap");
     MOZ_ASSERT(aSegment.mChunks.Capacity() >= DEFAULT_SEGMENT_CAPACITY,
@@ -570,17 +570,17 @@ protected:
     if (i+1 < mChunks.Length()) {
       mChunks.RemoveElementsAt(i+1, mChunks.Length() - (i+1));
     }
     MOZ_ASSERT(mChunks.Capacity() >= DEFAULT_SEGMENT_CAPACITY,
                "Capacity must be retained after removing chunks");
     // Caller must adjust mDuration
   }
 
-  nsTArray<Chunk> mChunks;
+  AutoTArray<Chunk, DEFAULT_SEGMENT_CAPACITY> mChunks;
 #ifdef MOZILLA_INTERNAL_API
   mozilla::TimeStamp mTimeStamp;
 #endif
 };
 
 } // namespace mozilla
 
 #endif /* MOZILLA_MEDIASEGMENT_H_ */