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

View File

@ -2303,7 +2303,7 @@ nsINode::GetBoundMutationObservers(nsTArray<nsRefPtr<nsDOMMutationObserver> >& a
nsCOMPtr<nsDOMMutationObserver> mo = do_QueryInterface(objects->ObjectAt(i)); nsCOMPtr<nsDOMMutationObserver> mo = do_QueryInterface(objects->ObjectAt(i));
if (mo) { if (mo) {
MOZ_ASSERT(!aResult.Contains(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; ++iter;
} while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter)); } while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter));
nsCOMPtr<nsIAtom> token = do_GetAtom(Substring(start, iter)); tokens->AppendElement(do_GetAtom(Substring(start, iter)));
tokens->AppendElement(token);
// skip whitespace // skip whitespace
while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) { while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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