Bug 1407549 - Make segments allocate chunk storage locally. r?padenot
MozReview-Commit-ID: 19VOLomq8A6
--- 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_ */