зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1185763 - Part 3: Rename nsTArray::MoveElementsFrom to AppendElements. r=froydnj
This commit is contained in:
Родитель
5528f2d07d
Коммит
2b4a52cf2e
|
@ -26,7 +26,7 @@ NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
|
|||
mEvent->message = aEventType;
|
||||
}
|
||||
if (aInvalidateRequests) {
|
||||
mInvalidateRequests.MoveElementsFrom(Move(aInvalidateRequests->mRequests));
|
||||
mInvalidateRequests.AppendElements(Move(aInvalidateRequests->mRequests));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ public:
|
|||
|
||||
IntervalSet(SelfType&& aOther)
|
||||
{
|
||||
mIntervals.MoveElementsFrom(Move(aOther.mIntervals));
|
||||
mIntervals.AppendElements(Move(aOther.mIntervals));
|
||||
}
|
||||
|
||||
explicit IntervalSet(const ElemType& aOther)
|
||||
|
@ -379,7 +379,7 @@ public:
|
|||
normalized.AppendElement(Move(mIntervals[i]));
|
||||
}
|
||||
mIntervals.Clear();
|
||||
mIntervals.MoveElementsFrom(Move(normalized));
|
||||
mIntervals.AppendElements(Move(normalized));
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ public:
|
|||
}
|
||||
}
|
||||
mIntervals.Clear();
|
||||
mIntervals.MoveElementsFrom(Move(intersection));
|
||||
mIntervals.AppendElements(Move(intersection));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ private:
|
|||
normalized.AppendElement(Move(current));
|
||||
|
||||
mIntervals.Clear();
|
||||
mIntervals.MoveElementsFrom(Move(normalized));
|
||||
mIntervals.AppendElements(Move(normalized));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -994,7 +994,7 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack,
|
|||
decoder.mDecoder->Shutdown();
|
||||
decoder.mDecoder = nullptr;
|
||||
if (sample->mKeyframe) {
|
||||
decoder.mQueuedSamples.MoveElementsFrom(Move(samples));
|
||||
decoder.mQueuedSamples.AppendElements(Move(samples));
|
||||
ScheduleUpdate(aTrack);
|
||||
} else {
|
||||
MOZ_ASSERT(decoder.mTimeThreshold.isNothing());
|
||||
|
|
|
@ -994,7 +994,7 @@ ApplyConstraints(const MediaTrackConstraints &aConstraints,
|
|||
}
|
||||
}
|
||||
if (!aSources.Length()) {
|
||||
aSources.MoveElementsFrom(Move(rejects));
|
||||
aSources.AppendElements(Move(rejects));
|
||||
aggregateConstraints.RemoveElementAt(aggregateConstraints.Length() - 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ protected:
|
|||
mChunks[mChunks.Length() - 1].mDuration += aSource->mChunks[0].mDuration;
|
||||
aSource->mChunks.RemoveElementAt(0);
|
||||
}
|
||||
mChunks.MoveElementsFrom(Move(aSource->mChunks));
|
||||
mChunks.AppendElements(Move(aSource->mChunks));
|
||||
}
|
||||
|
||||
void AppendSliceInternal(const MediaSegmentBase<C, Chunk>& aSource,
|
||||
|
|
|
@ -1225,7 +1225,7 @@ MediaStreamGraphImpl::PrepareUpdatesToMainThreadState(bool aFinalUpdate)
|
|||
update->mNextMainThreadFinished = stream->mNotifiedFinished;
|
||||
}
|
||||
if (!mPendingUpdateRunnables.IsEmpty()) {
|
||||
mUpdateRunnables.MoveElementsFrom(Move(mPendingUpdateRunnables));
|
||||
mUpdateRunnables.AppendElements(Move(mPendingUpdateRunnables));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1727,7 +1727,7 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
|
|||
// Defer calls to RunDuringShutdown() to happen while mMonitor is not held.
|
||||
for (uint32_t i = 0; i < mBackMessageQueue.Length(); ++i) {
|
||||
MessageBlock& mb = mBackMessageQueue[i];
|
||||
controlMessagesToRunDuringShutdown.MoveElementsFrom(Move(mb.mMessages));
|
||||
controlMessagesToRunDuringShutdown.AppendElements(Move(mb.mMessages));
|
||||
}
|
||||
mBackMessageQueue.Clear();
|
||||
MOZ_ASSERT(mCurrentTaskMessageQueue.IsEmpty());
|
||||
|
@ -2417,7 +2417,7 @@ void
|
|||
SourceMediaStream::FinishAddTracks()
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mUpdateTracks.MoveElementsFrom(Move(mPendingTracks));
|
||||
mUpdateTracks.AppendElements(Move(mPendingTracks));
|
||||
if (GraphImpl()) {
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ MediaEngineCameraVideoSource::ChooseCapability(
|
|||
}
|
||||
}
|
||||
if (!candidateSet.Length()) {
|
||||
candidateSet.MoveElementsFrom(Move(rejects));
|
||||
candidateSet.AppendElements(Move(rejects));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1188,14 +1188,14 @@ ContainerLayer::SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray)
|
|||
} else {
|
||||
if (toSort.Length() > 0) {
|
||||
SortLayersBy3DZOrder(toSort);
|
||||
aArray.MoveElementsFrom(Move(toSort));
|
||||
aArray.AppendElements(Move(toSort));
|
||||
}
|
||||
aArray.AppendElement(l);
|
||||
}
|
||||
}
|
||||
if (toSort.Length() > 0) {
|
||||
SortLayersBy3DZOrder(toSort);
|
||||
aArray.MoveElementsFrom(Move(toSort));
|
||||
aArray.AppendElements(Move(toSort));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ public:
|
|||
}
|
||||
void ExtractImageCompositeNotifications(nsTArray<ImageCompositeNotification>* aNotifications)
|
||||
{
|
||||
aNotifications->MoveElementsFrom(Move(mImageCompositeNotifications));
|
||||
aNotifications->AppendElements(Move(mImageCompositeNotifications));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -1811,7 +1811,7 @@ void FlushFramesArray(nsTArray<FramesWithDepth>& aSource, nsTArray<nsIFrame*>* a
|
|||
aSource.Sort();
|
||||
uint32_t length = aSource.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
aDest->MoveElementsFrom(Move(aSource[i].mFrames));
|
||||
aDest->AppendElements(Move(aSource[i].mFrames));
|
||||
}
|
||||
aSource.Clear();
|
||||
}
|
||||
|
|
|
@ -2926,7 +2926,7 @@ protected:
|
|||
mBounds.UnionRect(mBounds, aOther->mBounds);
|
||||
mVisibleRect.UnionRect(mVisibleRect, aOther->mVisibleRect);
|
||||
mMergedFrames.AppendElement(aOther->mFrame);
|
||||
mMergedFrames.MoveElementsFrom(mozilla::Move(aOther->mMergedFrames));
|
||||
mMergedFrames.AppendElements(mozilla::Move(aOther->mMergedFrames));
|
||||
}
|
||||
|
||||
nsDisplayList mList;
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
void TakeFrom(nsInvalidateRequestList* aList)
|
||||
{
|
||||
mRequests.MoveElementsFrom(mozilla::Move(aList->mRequests));
|
||||
mRequests.AppendElements(mozilla::Move(aList->mRequests));
|
||||
}
|
||||
bool IsEmpty() { return mRequests.IsEmpty(); }
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ nsHtml5Speculation::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
|
|||
mOpQueue.SwapElements(aOpQueue);
|
||||
return;
|
||||
}
|
||||
mOpQueue.MoveElementsFrom(Move(aOpQueue));
|
||||
mOpQueue.AppendElements(Move(aOpQueue));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -790,7 +790,7 @@ nsHtml5TreeOpExecutor::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
|
|||
mOpQueue.SwapElements(aOpQueue);
|
||||
return;
|
||||
}
|
||||
mOpQueue.MoveElementsFrom(Move(aOpQueue));
|
||||
mOpQueue.AppendElements(Move(aOpQueue));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -22,7 +22,7 @@ nsHtml5TreeOpStage::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
|
|||
if (mOpQueue.IsEmpty()) {
|
||||
mOpQueue.SwapElements(aOpQueue);
|
||||
} else {
|
||||
mOpQueue.MoveElementsFrom(Move(aOpQueue));
|
||||
mOpQueue.AppendElements(Move(aOpQueue));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ nsHtml5TreeOpStage::MoveOpsAndSpeculativeLoadsTo(nsTArray<nsHtml5TreeOperation>&
|
|||
if (aOpQueue.IsEmpty()) {
|
||||
mOpQueue.SwapElements(aOpQueue);
|
||||
} else {
|
||||
aOpQueue.MoveElementsFrom(Move(mOpQueue));
|
||||
aOpQueue.AppendElements(Move(mOpQueue));
|
||||
}
|
||||
if (aSpeculativeLoadQueue.IsEmpty()) {
|
||||
mSpeculativeLoadQueue.SwapElements(aSpeculativeLoadQueue);
|
||||
} else {
|
||||
aSpeculativeLoadQueue.MoveElementsFrom(Move(mSpeculativeLoadQueue));
|
||||
aSpeculativeLoadQueue.AppendElements(Move(mSpeculativeLoadQueue));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ nsHtml5TreeOpStage::MoveSpeculativeLoadsFrom(nsTArray<nsHtml5SpeculativeLoad>& a
|
|||
if (mSpeculativeLoadQueue.IsEmpty()) {
|
||||
mSpeculativeLoadQueue.SwapElements(aSpeculativeLoadQueue);
|
||||
} else {
|
||||
mSpeculativeLoadQueue.MoveElementsFrom(Move(aSpeculativeLoadQueue));
|
||||
mSpeculativeLoadQueue.AppendElements(Move(aSpeculativeLoadQueue));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ nsHtml5TreeOpStage::MoveSpeculativeLoadsTo(nsTArray<nsHtml5SpeculativeLoad>& aSp
|
|||
if (aSpeculativeLoadQueue.IsEmpty()) {
|
||||
mSpeculativeLoadQueue.SwapElements(aSpeculativeLoadQueue);
|
||||
} else {
|
||||
aSpeculativeLoadQueue.MoveElementsFrom(Move(mSpeculativeLoadQueue));
|
||||
aSpeculativeLoadQueue.AppendElements(Move(mSpeculativeLoadQueue));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ void
|
|||
TraceInfo::MoveLogsInto(TraceInfoLogsType& aResult)
|
||||
{
|
||||
MutexAutoLock lock(mLogsMutex);
|
||||
aResult.MoveElementsFrom(Move(mLogs));
|
||||
aResult.AppendElements(Move(mLogs));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1538,6 +1538,26 @@ public:
|
|||
return AppendElements<Item, Allocator, FallibleAlloc>(aArray);
|
||||
}
|
||||
|
||||
// Move all elements from another array to the end of this array.
|
||||
// @return A pointer to the newly appended elements, or null on OOM.
|
||||
template<class Item, class Allocator>
|
||||
elem_type* AppendElements(nsTArray_Impl<Item, Allocator>&& aArray)
|
||||
{
|
||||
MOZ_ASSERT(&aArray != this, "argument must be different aArray");
|
||||
index_type len = Length();
|
||||
index_type otherLen = aArray.Length();
|
||||
if (!Alloc::Successful(this->template EnsureCapacity<Alloc>(
|
||||
len + otherLen, sizeof(elem_type)))) {
|
||||
return nullptr;
|
||||
}
|
||||
copy_type::CopyElements(Elements() + len, aArray.Elements(), otherLen,
|
||||
sizeof(elem_type));
|
||||
this->IncrementLength(otherLen);
|
||||
aArray.template ShiftData<Alloc>(0, otherLen, 0, sizeof(elem_type),
|
||||
MOZ_ALIGNOF(elem_type));
|
||||
return Elements() + len;
|
||||
}
|
||||
|
||||
// Append a new element, move constructing if possible.
|
||||
protected:
|
||||
template<class Item, typename ActualAlloc = Alloc>
|
||||
|
@ -1606,27 +1626,6 @@ public:
|
|||
return AppendElement<FallibleAlloc>();
|
||||
}
|
||||
|
||||
// Move all elements from another array to the end of this array without
|
||||
// calling copy constructors or destructors.
|
||||
// @return A pointer to the newly appended elements, or null on OOM.
|
||||
template<class Item, class Allocator>
|
||||
elem_type* MoveElementsFrom(nsTArray_Impl<Item, Allocator>&& aArray)
|
||||
{
|
||||
MOZ_ASSERT(&aArray != this, "argument must be different aArray");
|
||||
index_type len = Length();
|
||||
index_type otherLen = aArray.Length();
|
||||
if (!Alloc::Successful(this->template EnsureCapacity<Alloc>(
|
||||
len + otherLen, sizeof(elem_type)))) {
|
||||
return nullptr;
|
||||
}
|
||||
copy_type::CopyElements(Elements() + len, aArray.Elements(), otherLen,
|
||||
sizeof(elem_type));
|
||||
this->IncrementLength(otherLen);
|
||||
aArray.template ShiftData<Alloc>(0, otherLen, 0, sizeof(elem_type),
|
||||
MOZ_ALIGNOF(elem_type));
|
||||
return Elements() + len;
|
||||
}
|
||||
|
||||
// This method removes a range of elements from this array.
|
||||
// @param aStart The starting index of the elements to remove.
|
||||
// @param aCount The number of elements to remove.
|
||||
|
@ -2120,7 +2119,6 @@ public:
|
|||
using base_type::InsertElementAt;
|
||||
using base_type::InsertElementsAt;
|
||||
using base_type::InsertElementSorted;
|
||||
using base_type::MoveElementsFrom;
|
||||
using base_type::ReplaceElementsAt;
|
||||
using base_type::SetCapacity;
|
||||
using base_type::SetLength;
|
||||
|
|
Загрузка…
Ссылка в новой задаче