Bug 982212: Part 3 - Now that nsTArray::AppendElement supports r-value references, remove the workarounds added in Bug 967364. r=nfroyd

--HG--
extra : rebase_source : 1e6188d26b745f6dc9bdf2accc0abf7f07351510
This commit is contained in:
Kyle Huey 2014-03-15 18:56:00 +01:00
parent e25a4db36c
commit a34a3ab32d
10 changed files with 13 additions and 23 deletions

View File

@ -10437,8 +10437,7 @@ FullscreenRoots::Add(nsIDocument* aRoot)
if (!sInstance) {
sInstance = new FullscreenRoots();
}
nsWeakPtr weakRoot = do_GetWeakReference(aRoot);
sInstance->mRoots.AppendElement(weakRoot);
sInstance->mRoots.AppendElement(do_GetWeakReference(aRoot));
}
}
@ -11011,8 +11010,7 @@ nsDocument::FullScreenStackPush(Element* aElement)
EventStateManager::SetFullScreenState(top, false);
}
EventStateManager::SetFullScreenState(aElement, true);
nsWeakPtr weakElement = do_GetWeakReference(aElement);
mFullScreenStack.AppendElement(weakElement);
mFullScreenStack.AppendElement(do_GetWeakReference(aElement));
NS_ASSERTION(GetFullScreenElement() == aElement, "Should match");
return true;
}

View File

@ -2303,7 +2303,7 @@ nsINode::GetBoundMutationObservers(nsTArray<nsRefPtr<nsDOMMutationObserver> >& a
nsCOMPtr<nsDOMMutationObserver> mo = do_QueryInterface(objects->ObjectAt(i));
if (mo) {
MOZ_ASSERT(!aResult.Contains(mo));
aResult.AppendElement(mo);
aResult.AppendElement(mo.forget());
}
}
}

View File

@ -1998,8 +1998,7 @@ static void* CreateTokens(nsINode* aRootNode, const nsString* types)
++iter;
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
nsCOMPtr<nsIAtom> token = do_GetAtom(Substring(start, iter));
tokens->AppendElement(token);
tokens->AppendElement(do_GetAtom(Substring(start, iter)));
// skip whitespace
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {

View File

@ -464,7 +464,7 @@ AudioContext::DecodeAudioData(const ArrayBuffer& aBuffer,
&aSuccessCallback, failureCallback));
mDecoder.AsyncDecodeMedia(contentType.get(), data, length, *job);
// Transfer the ownership to mDecodeJobs
mDecodeJobs.AppendElement(job);
mDecodeJobs.AppendElement(job.forget());
}
void

View File

@ -802,7 +802,7 @@ SpeechRecognition::SplitSamplesBuffer(const int16_t* aSamplesBuffer,
memcpy(chunk->Data(), aSamplesBuffer + chunkStart,
mAudioSamplesPerChunk * sizeof(int16_t));
aResult.AppendElement(chunk);
aResult.AppendElement(chunk.forget());
chunkStart += mAudioSamplesPerChunk;
}
@ -851,8 +851,7 @@ SpeechRecognition::FeedAudioData(already_AddRefed<SharedBuffer> aSamples,
samplesIndex += FillSamplesBuffer(samples, aDuration);
if (mBufferedSamples == mAudioSamplesPerChunk) {
chunksToSend.AppendElement(mAudioSamplesBuffer);
mAudioSamplesBuffer = nullptr;
chunksToSend.AppendElement(mAudioSamplesBuffer.forget());
mBufferedSamples = 0;
}
}

View File

@ -126,8 +126,7 @@ nsresult nsDocShellForwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
// add this item to the array
if (mDocShellType == nsIDocShellTreeItem::typeAll ||
inItem->ItemType() == mDocShellType) {
nsWeakPtr weakItem = do_GetWeakReference(inItem);
if (!inItemArray.AppendElement(weakItem))
if (!inItemArray.AppendElement(do_GetWeakReference(inItem)))
return NS_ERROR_OUT_OF_MEMORY;
}
@ -170,8 +169,7 @@ nsresult nsDocShellBackwardsEnumerator::BuildArrayRecursive(nsIDocShellTreeItem*
// add this item to the array
if (mDocShellType == nsIDocShellTreeItem::typeAll ||
inItem->ItemType() == mDocShellType) {
nsWeakPtr weakItem = do_GetWeakReference(inItem);
if (!inItemArray.AppendElement(weakItem))
if (!inItemArray.AppendElement(do_GetWeakReference(inItem)))
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -1500,8 +1500,7 @@ IndexedDBObjectStoreRequestParent::ConvertBlobActors(
for (uint32_t index = 0; index < length; index++) {
BlobParent* actor = static_cast<BlobParent*>(aActors[index]);
nsCOMPtr<nsIDOMBlob> blob = actor->GetBlob();
aBlobs.AppendElement(blob);
aBlobs.AppendElement(actor->GetBlob());
}
}
}

View File

@ -62,8 +62,7 @@ XBLChildrenElement::ParseAttribute(int32_t aNamespaceID,
nsCharSeparatedTokenizer tok(aValue, '|',
nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
while (tok.hasMoreTokens()) {
nsCOMPtr<nsIAtom> atom = do_GetAtom(tok.nextToken());
mIncludes.AppendElement(atom);
mIncludes.AppendElement(do_GetAtom(tok.nextToken()));
}
}

View File

@ -2762,8 +2762,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
* incremented during empty transactions.
*/
void AddPaintedPresShell(nsIPresShell* shell) {
nsWeakPtr weakShell = do_GetWeakReference(shell);
PaintedPresShellList()->AppendElement(weakShell);
PaintedPresShellList()->AppendElement(do_GetWeakReference(shell));
}
/**

View File

@ -133,8 +133,7 @@ void
RtspControllerChild::AddMetaData(
already_AddRefed<nsIStreamingProtocolMetaData>&& meta)
{
nsCOMPtr<nsIStreamingProtocolMetaData> data = meta;
mMetaArray.AppendElement(data);
mMetaArray.AppendElement(mozilla::Move(meta));
}
int