diff --git a/dom/base/nsLineBreaker.cpp b/dom/base/nsLineBreaker.cpp index 2a2296e33833..89d5e6a59f61 100644 --- a/dom/base/nsLineBreaker.cpp +++ b/dom/base/nsLineBreaker.cpp @@ -313,7 +313,7 @@ nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator, uint8_t *aBreakState) { nsDependentSubstring string(aTextStart, aTextLimit); - AutoFallibleTArray hyphens; + AutoTArray hyphens; if (NS_SUCCEEDED(aHyphenator->Hyphenate(string, hyphens))) { for (uint32_t i = 0; i + 1 < string.Length(); ++i) { if (hyphens[i]) { diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 3f2faa0bfa64..6d3d54435cb1 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -838,10 +838,9 @@ MakeCompressedIndexDataValues( } nsresult -ReadCompressedIndexDataValuesFromBlob( - const uint8_t* aBlobData, - uint32_t aBlobDataLength, - FallibleTArray& aIndexValues) +ReadCompressedIndexDataValuesFromBlob(const uint8_t* aBlobData, + uint32_t aBlobDataLength, + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -916,10 +915,9 @@ ReadCompressedIndexDataValuesFromBlob( // static template nsresult -ReadCompressedIndexDataValuesFromSource( - T* aSource, - uint32_t aColumnIndex, - FallibleTArray& aIndexValues) +ReadCompressedIndexDataValuesFromSource(T* aSource, + uint32_t aColumnIndex, + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -963,7 +961,7 @@ ReadCompressedIndexDataValuesFromSource( nsresult ReadCompressedIndexDataValues(mozIStorageStatement* aStatement, uint32_t aColumnIndex, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { return ReadCompressedIndexDataValuesFromSource(aStatement, aColumnIndex, @@ -973,7 +971,7 @@ ReadCompressedIndexDataValues(mozIStorageStatement* aStatement, nsresult ReadCompressedIndexDataValues(mozIStorageValueArray* aValues, uint32_t aColumnIndex, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { return ReadCompressedIndexDataValuesFromSource(aValues, aColumnIndex, @@ -2768,7 +2766,7 @@ InsertIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues, // Read out the previous value. It may be NULL, in which case we'll just end // up with an empty array. - AutoFallibleTArray indexValues; + AutoTArray indexValues; nsresult rv = ReadCompressedIndexDataValues(aValues, 0, indexValues); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -3866,7 +3864,7 @@ private: nsresult ReadOldCompressedIDVFromBlob(const uint8_t* aBlobData, uint32_t aBlobDataLength, - FallibleTArray& aIndexValues); + nsTArray& aIndexValues); NS_IMETHOD OnFunctionCall(mozIStorageValueArray* aArguments, @@ -3879,7 +3877,7 @@ nsresult UpgradeIndexDataValuesFunction::ReadOldCompressedIDVFromBlob( const uint8_t* aBlobData, uint32_t aBlobDataLength, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -3991,7 +3989,7 @@ UpgradeIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aArguments return rv; } - AutoFallibleTArray oldIdv; + AutoTArray oldIdv; rv = ReadOldCompressedIDVFromBlob(oldBlob, oldBlobLength, oldIdv); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -5862,10 +5860,9 @@ protected: Maybe& aMaybeUniqueIndexTable); static nsresult - IndexDataValuesFromUpdateInfos( - const nsTArray& aUpdateInfos, - const UniqueIndexTable& aUniqueIndexTable, - FallibleTArray& aIndexValues); + IndexDataValuesFromUpdateInfos(const nsTArray& aUpdateInfos, + const UniqueIndexTable& aUniqueIndexTable, + nsTArray& aIndexValues); static nsresult InsertIndexTableRows(DatabaseConnection* aConnection, @@ -7912,7 +7909,7 @@ private: nsresult RemoveReferencesToIndex(DatabaseConnection* aConnection, const Key& aObjectDataKey, - FallibleTArray& aIndexValues); + nsTArray& aIndexValues); virtual nsresult DoDatabaseWork(DatabaseConnection* aConnection) override; @@ -18403,7 +18400,7 @@ nsresult DatabaseOperationBase::IndexDataValuesFromUpdateInfos( const nsTArray& aUpdateInfos, const UniqueIndexTable& aUniqueIndexTable, - FallibleTArray& aIndexValues) + nsTArray& aIndexValues) { MOZ_ASSERT(aIndexValues.IsEmpty()); MOZ_ASSERT_IF(!aUpdateInfos.IsEmpty(), aUniqueIndexTable.Count()); @@ -18723,7 +18720,7 @@ DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes( } DatabaseConnection::CachedStatement deleteStmt; - AutoFallibleTArray indexValues; + AutoTArray indexValues; DebugOnly resultCountDEBUG = 0; @@ -23410,7 +23407,7 @@ UpdateIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues, return rv; } - AutoFallibleTArray indexValues; + AutoTArray indexValues; rv = ReadCompressedIndexDataValues(aValues, 1, indexValues); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; @@ -23509,10 +23506,9 @@ DeleteIndexOp::DeleteIndexOp(VersionChangeTransaction* aTransaction, } nsresult -DeleteIndexOp::RemoveReferencesToIndex( - DatabaseConnection* aConnection, - const Key& aObjectStoreKey, - FallibleTArray& aIndexValues) +DeleteIndexOp::RemoveReferencesToIndex(DatabaseConnection* aConnection, + const Key& aObjectStoreKey, + nsTArray& aIndexValues) { MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!IsOnBackgroundThread()); @@ -23767,7 +23763,7 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection) DatabaseConnection::CachedStatement nullIndexDataValuesStmt; Key lastObjectStoreKey; - AutoFallibleTArray lastIndexValues; + AutoTArray lastIndexValues; bool hasResult; while (NS_SUCCEEDED(rv = selectStmt->ExecuteStep(&hasResult)) && hasResult) { @@ -24111,7 +24107,7 @@ ObjectStoreAddOrPutRequestOp::RemoveOldIndexDataValues( } if (hasResult) { - AutoFallibleTArray existingIndexValues; + AutoTArray existingIndexValues; rv = ReadCompressedIndexDataValues(indexValuesStmt, 0, existingIndexValues); @@ -24639,7 +24635,7 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection) MOZ_ASSERT(mUniqueIndexTable.isSome()); // Write the index_data_values column. - AutoFallibleTArray indexValues; + AutoTArray indexValues; rv = IndexDataValuesFromUpdateInfos(mParams.indexUpdateInfos(), mUniqueIndexTable.ref(), indexValues); diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index f8c5b2d13139..305c696d6743 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -398,7 +398,7 @@ UsingArabicOrHebrewScriptSystemLocale() nsresult gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray &aBuffer) + nsTArray &aBuffer) { gfxDWriteFontList *pFontList = gfxDWriteFontList::PlatformFontList(); @@ -679,7 +679,7 @@ gfxDWriteFontEntry::IsCJKFont() mIsCJK = false; const uint32_t kOS2Tag = TRUETYPE_TAG('O','S','/','2'); - AutoFallibleTArray buffer; + AutoTArray buffer; if (CopyFontTable(kOS2Tag, buffer) != NS_OK) { return mIsCJK; } diff --git a/gfx/thebes/gfxDWriteFontList.h b/gfx/thebes/gfxDWriteFontList.h index 9cf19149c16c..e9d992b0d28e 100644 --- a/gfx/thebes/gfxDWriteFontList.h +++ b/gfx/thebes/gfxDWriteFontList.h @@ -175,7 +175,7 @@ protected: friend class gfxDWriteFontList; virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold); diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index e007945dec41..789961d7338a 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -457,7 +457,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData) RefPtr charmap = new gfxCharacterMap(); - AutoFallibleTArray buffer; + AutoTArray buffer; nsresult rv = CopyFontTable(TTAG_cmap, buffer); if (NS_SUCCEEDED(rv)) { @@ -511,8 +511,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData) } nsresult -FT2FontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) +FT2FontEntry::CopyFontTable(uint32_t aTableTag, nsTArray& aBuffer) { AutoFTFace face(this); if (!face) { diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index c5748a704bc4..05b7ff27cdb9 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -78,7 +78,7 @@ public: virtual hb_blob_t* GetFontTable(uint32_t aTableTag) override; virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; // Check for various kinds of brokenness, and set flags on the entry // accordingly so that we avoid using bad font tables diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index e0b63ce38d20..463bd763da85 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -744,7 +744,7 @@ gfxFontconfigFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, nsresult gfxFontconfigFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) + nsTArray& aBuffer) { NS_ASSERTION(!mIsDataUserFont, "data fonts should be reading tables directly from memory"); diff --git a/gfx/thebes/gfxFcPlatformFontList.h b/gfx/thebes/gfxFcPlatformFontList.h index 951e9eb5807c..8873a5909343 100644 --- a/gfx/thebes/gfxFcPlatformFontList.h +++ b/gfx/thebes/gfxFcPlatformFontList.h @@ -137,7 +137,7 @@ protected: // override to pull data from FTFace virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; // if HB or GR faces are gone, close down the FT_Face void MaybeReleaseFTFace(); diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp index 84fcbd2bcc92..528a869497ef 100644 --- a/gfx/thebes/gfxFontEntry.cpp +++ b/gfx/thebes/gfxFontEntry.cpp @@ -523,12 +523,12 @@ gfxFontEntry::TryGetColorGlyphs() class gfxFontEntry::FontTableBlobData { public: - // Adopts the content of aBuffer. - explicit FontTableBlobData(FallibleTArray& aBuffer) - : mHashtable(nullptr), mHashKey(0) + explicit FontTableBlobData(nsTArray&& aBuffer) + : mTableData(Move(aBuffer)) + , mHashtable(nullptr) + , mHashKey(0) { MOZ_COUNT_CTOR(FontTableBlobData); - mTableData.SwapElements(aBuffer); } ~FontTableBlobData() { @@ -570,8 +570,8 @@ public: } private: - // The font table data block, owned (via adoption) - FallibleTArray mTableData; + // The font table data block + nsTArray mTableData; // The blob destroy function needs to know the owning hashtable // and the hashtable key, so that it can remove the entry. @@ -584,12 +584,12 @@ private: hb_blob_t * gfxFontEntry::FontTableHashEntry:: -ShareTableAndGetBlob(FallibleTArray& aTable, +ShareTableAndGetBlob(nsTArray&& aTable, nsTHashtable *aHashtable) { Clear(); // adopts elements of aTable - mSharedBlobData = new FontTableBlobData(aTable); + mSharedBlobData = new FontTableBlobData(Move(aTable)); mBlob = hb_blob_create(mSharedBlobData->GetTable(), mSharedBlobData->GetTableLength(), HB_MEMORY_MODE_READONLY, @@ -656,7 +656,7 @@ gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t **aBlob) hb_blob_t * gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag, - FallibleTArray* aBuffer) + nsTArray* aBuffer) { if (MOZ_UNLIKELY(!mFontTableCache)) { // we do this here rather than on fontEntry construction @@ -675,7 +675,7 @@ gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag, return nullptr; } - return entry->ShareTableAndGetBlob(*aBuffer, mFontTableCache); + return entry->ShareTableAndGetBlob(Move(*aBuffer), mFontTableCache); } static int @@ -725,7 +725,7 @@ gfxFontEntry::GetFontTable(uint32_t aTag) return blob; } - FallibleTArray buffer; + nsTArray buffer; bool haveTable = NS_SUCCEEDED(CopyFontTable(aTag, buffer)); return ShareFontTableAndGetBlob(aTag, haveTable ? &buffer : nullptr); diff --git a/gfx/thebes/gfxFontEntry.h b/gfx/thebes/gfxFontEntry.h index 2bf1c75576e6..1b03a9b251e8 100644 --- a/gfx/thebes/gfxFontEntry.h +++ b/gfx/thebes/gfxFontEntry.h @@ -337,7 +337,7 @@ public: // Pass nullptr for aBuffer to indicate that the table is not present and // nullptr will be returned. Also returns nullptr on OOM. hb_blob_t *ShareFontTableAndGetBlob(uint32_t aTag, - FallibleTArray* aTable); + nsTArray* aTable); // Get the font's unitsPerEm from the 'head' table, in the case of an // sfnt resource. Will return kInvalidUPEM for non-sfnt fonts, @@ -469,7 +469,7 @@ protected: // Copy a font table into aBuffer. // The caller will be responsible for ownership of the data. virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) { + nsTArray& aBuffer) { NS_NOTREACHED("forgot to override either GetFontTable or CopyFontTable?"); return NS_ERROR_FAILURE; } @@ -605,7 +605,7 @@ private: // recorded in the hashtable entry so that others may use the same // table. hb_blob_t * - ShareTableAndGetBlob(FallibleTArray& aTable, + ShareTableAndGetBlob(nsTArray&& aTable, nsTHashtable *aHashtable); // Return a strong reference to the blob. diff --git a/gfx/thebes/gfxFontconfigFonts.cpp b/gfx/thebes/gfxFontconfigFonts.cpp index 2e5950e1a05c..31190800aeea 100644 --- a/gfx/thebes/gfxFontconfigFonts.cpp +++ b/gfx/thebes/gfxFontconfigFonts.cpp @@ -216,7 +216,7 @@ public: protected: virtual nsresult - CopyFontTable(uint32_t aTableTag, FallibleTArray& aBuffer) override; + CopyFontTable(uint32_t aTableTag, nsTArray& aBuffer) override; void MaybeReleaseFTFace(); @@ -228,7 +228,7 @@ private: nsresult gfxSystemFcFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) + nsTArray& aBuffer) { if (!mFTFaceInitialized) { mFTFaceInitialized = true; diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 0142afcec541..d297487819e7 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -173,7 +173,7 @@ GDIFontEntry::ReadCMAP(FontInfoData *aFontInfoData) } else { uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p'); charmap = new gfxCharacterMap(); - AutoFallibleTArray cmap; + AutoTArray cmap; rv = CopyFontTable(kCMAP, cmap); if (NS_SUCCEEDED(rv)) { @@ -234,8 +234,7 @@ GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, bool aNeedsBold } nsresult -GDIFontEntry::CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) +GDIFontEntry::CopyFontTable(uint32_t aTableTag, nsTArray& aBuffer) { if (!IsTrueType()) { return NS_ERROR_FAILURE; diff --git a/gfx/thebes/gfxGDIFontList.h b/gfx/thebes/gfxGDIFontList.h index 66d467bbe01e..5d6c6ea0a3ea 100644 --- a/gfx/thebes/gfxGDIFontList.h +++ b/gfx/thebes/gfxGDIFontList.h @@ -274,7 +274,7 @@ protected: virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold); virtual nsresult CopyFontTable(uint32_t aTableTag, - FallibleTArray& aBuffer) override; + nsTArray& aBuffer) override; LOGFONTW mLogFont; }; diff --git a/intl/hyphenation/glue/nsHyphenator.cpp b/intl/hyphenation/glue/nsHyphenator.cpp index 6235f5550c8c..bcb87baf602c 100644 --- a/intl/hyphenation/glue/nsHyphenator.cpp +++ b/intl/hyphenation/glue/nsHyphenator.cpp @@ -43,8 +43,7 @@ nsHyphenator::IsValid() } nsresult -nsHyphenator::Hyphenate(const nsAString& aString, - FallibleTArray& aHyphens) +nsHyphenator::Hyphenate(const nsAString& aString, nsTArray& aHyphens) { if (!aHyphens.SetLength(aString.Length(), mozilla::fallible)) { return NS_ERROR_OUT_OF_MEMORY; diff --git a/intl/hyphenation/glue/nsHyphenator.h b/intl/hyphenation/glue/nsHyphenator.h index 37b5613da945..96975d253352 100644 --- a/intl/hyphenation/glue/nsHyphenator.h +++ b/intl/hyphenation/glue/nsHyphenator.h @@ -21,7 +21,7 @@ public: bool IsValid(); - nsresult Hyphenate(const nsAString& aText, FallibleTArray& aHyphens); + nsresult Hyphenate(const nsAString& aText, nsTArray& aHyphens); private: ~nsHyphenator(); diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index f90d56e440ed..96d2686e49de 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1472,7 +1472,7 @@ nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint) static bool GetStrokeDashData(nsIFrame* aFrame, - FallibleTArray& aDashes, + nsTArray& aDashes, gfxFloat* aDashOffset, gfxTextContextPaint *aContextPaint) { @@ -1576,7 +1576,7 @@ nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame, break; } - AutoFallibleTArray dashes; + AutoTArray dashes; gfxFloat dashOffset; if (GetStrokeDashData(aFrame, dashes, &dashOffset, aContextPaint)) { aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset);