Bug 1185763 - Part 3: Rename nsTArray::MoveElementsFrom to AppendElements. r=froydnj

This commit is contained in:
Birunthan Mohanathas 2015-08-11 08:29:46 -07:00
Родитель 5528f2d07d
Коммит 2b4a52cf2e
17 изменённых файлов: 46 добавлений и 48 удалений

Просмотреть файл

@ -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;