mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1235261 - Part 2: Switch some uses of AutoFallibleTArray to AutoTArray. r=froydnj
This changes some function signatures to take a nsTArray<T>& instead of a FallibleTArray<T>& because AutoTArray does not inherit from FallibleTArray. This is effectively a no-op because the affected array operations already use `mozilla::fallible`.
This commit is contained in:
parent
373593275e
commit
53bb27f2a4
@ -313,7 +313,7 @@ nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator,
|
|||||||
uint8_t *aBreakState)
|
uint8_t *aBreakState)
|
||||||
{
|
{
|
||||||
nsDependentSubstring string(aTextStart, aTextLimit);
|
nsDependentSubstring string(aTextStart, aTextLimit);
|
||||||
AutoFallibleTArray<bool,200> hyphens;
|
AutoTArray<bool,200> hyphens;
|
||||||
if (NS_SUCCEEDED(aHyphenator->Hyphenate(string, hyphens))) {
|
if (NS_SUCCEEDED(aHyphenator->Hyphenate(string, hyphens))) {
|
||||||
for (uint32_t i = 0; i + 1 < string.Length(); ++i) {
|
for (uint32_t i = 0; i + 1 < string.Length(); ++i) {
|
||||||
if (hyphens[i]) {
|
if (hyphens[i]) {
|
||||||
|
@ -838,10 +838,9 @@ MakeCompressedIndexDataValues(
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
ReadCompressedIndexDataValuesFromBlob(
|
ReadCompressedIndexDataValuesFromBlob(const uint8_t* aBlobData,
|
||||||
const uint8_t* aBlobData,
|
uint32_t aBlobDataLength,
|
||||||
uint32_t aBlobDataLength,
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_ASSERT(!IsOnBackgroundThread());
|
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||||
@ -916,10 +915,9 @@ ReadCompressedIndexDataValuesFromBlob(
|
|||||||
// static
|
// static
|
||||||
template <typename T>
|
template <typename T>
|
||||||
nsresult
|
nsresult
|
||||||
ReadCompressedIndexDataValuesFromSource(
|
ReadCompressedIndexDataValuesFromSource(T* aSource,
|
||||||
T* aSource,
|
uint32_t aColumnIndex,
|
||||||
uint32_t aColumnIndex,
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_ASSERT(!IsOnBackgroundThread());
|
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||||
@ -963,7 +961,7 @@ ReadCompressedIndexDataValuesFromSource(
|
|||||||
nsresult
|
nsresult
|
||||||
ReadCompressedIndexDataValues(mozIStorageStatement* aStatement,
|
ReadCompressedIndexDataValues(mozIStorageStatement* aStatement,
|
||||||
uint32_t aColumnIndex,
|
uint32_t aColumnIndex,
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
{
|
{
|
||||||
return ReadCompressedIndexDataValuesFromSource(aStatement,
|
return ReadCompressedIndexDataValuesFromSource(aStatement,
|
||||||
aColumnIndex,
|
aColumnIndex,
|
||||||
@ -973,7 +971,7 @@ ReadCompressedIndexDataValues(mozIStorageStatement* aStatement,
|
|||||||
nsresult
|
nsresult
|
||||||
ReadCompressedIndexDataValues(mozIStorageValueArray* aValues,
|
ReadCompressedIndexDataValues(mozIStorageValueArray* aValues,
|
||||||
uint32_t aColumnIndex,
|
uint32_t aColumnIndex,
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
{
|
{
|
||||||
return ReadCompressedIndexDataValuesFromSource(aValues,
|
return ReadCompressedIndexDataValuesFromSource(aValues,
|
||||||
aColumnIndex,
|
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
|
// Read out the previous value. It may be NULL, in which case we'll just end
|
||||||
// up with an empty array.
|
// up with an empty array.
|
||||||
AutoFallibleTArray<IndexDataValue, 32> indexValues;
|
AutoTArray<IndexDataValue, 32> indexValues;
|
||||||
nsresult rv = ReadCompressedIndexDataValues(aValues, 0, indexValues);
|
nsresult rv = ReadCompressedIndexDataValues(aValues, 0, indexValues);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -3866,7 +3864,7 @@ private:
|
|||||||
nsresult
|
nsresult
|
||||||
ReadOldCompressedIDVFromBlob(const uint8_t* aBlobData,
|
ReadOldCompressedIDVFromBlob(const uint8_t* aBlobData,
|
||||||
uint32_t aBlobDataLength,
|
uint32_t aBlobDataLength,
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues);
|
nsTArray<IndexDataValue>& aIndexValues);
|
||||||
|
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
OnFunctionCall(mozIStorageValueArray* aArguments,
|
OnFunctionCall(mozIStorageValueArray* aArguments,
|
||||||
@ -3879,7 +3877,7 @@ nsresult
|
|||||||
UpgradeIndexDataValuesFunction::ReadOldCompressedIDVFromBlob(
|
UpgradeIndexDataValuesFunction::ReadOldCompressedIDVFromBlob(
|
||||||
const uint8_t* aBlobData,
|
const uint8_t* aBlobData,
|
||||||
uint32_t aBlobDataLength,
|
uint32_t aBlobDataLength,
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_ASSERT(!IsOnBackgroundThread());
|
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||||
@ -3991,7 +3989,7 @@ UpgradeIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aArguments
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoFallibleTArray<IndexDataValue, 32> oldIdv;
|
AutoTArray<IndexDataValue, 32> oldIdv;
|
||||||
rv = ReadOldCompressedIDVFromBlob(oldBlob, oldBlobLength, oldIdv);
|
rv = ReadOldCompressedIDVFromBlob(oldBlob, oldBlobLength, oldIdv);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -5862,10 +5860,9 @@ protected:
|
|||||||
Maybe<UniqueIndexTable>& aMaybeUniqueIndexTable);
|
Maybe<UniqueIndexTable>& aMaybeUniqueIndexTable);
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
IndexDataValuesFromUpdateInfos(
|
IndexDataValuesFromUpdateInfos(const nsTArray<IndexUpdateInfo>& aUpdateInfos,
|
||||||
const nsTArray<IndexUpdateInfo>& aUpdateInfos,
|
const UniqueIndexTable& aUniqueIndexTable,
|
||||||
const UniqueIndexTable& aUniqueIndexTable,
|
nsTArray<IndexDataValue>& aIndexValues);
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues);
|
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
InsertIndexTableRows(DatabaseConnection* aConnection,
|
InsertIndexTableRows(DatabaseConnection* aConnection,
|
||||||
@ -7912,7 +7909,7 @@ private:
|
|||||||
nsresult
|
nsresult
|
||||||
RemoveReferencesToIndex(DatabaseConnection* aConnection,
|
RemoveReferencesToIndex(DatabaseConnection* aConnection,
|
||||||
const Key& aObjectDataKey,
|
const Key& aObjectDataKey,
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues);
|
nsTArray<IndexDataValue>& aIndexValues);
|
||||||
|
|
||||||
virtual nsresult
|
virtual nsresult
|
||||||
DoDatabaseWork(DatabaseConnection* aConnection) override;
|
DoDatabaseWork(DatabaseConnection* aConnection) override;
|
||||||
@ -18403,7 +18400,7 @@ nsresult
|
|||||||
DatabaseOperationBase::IndexDataValuesFromUpdateInfos(
|
DatabaseOperationBase::IndexDataValuesFromUpdateInfos(
|
||||||
const nsTArray<IndexUpdateInfo>& aUpdateInfos,
|
const nsTArray<IndexUpdateInfo>& aUpdateInfos,
|
||||||
const UniqueIndexTable& aUniqueIndexTable,
|
const UniqueIndexTable& aUniqueIndexTable,
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aIndexValues.IsEmpty());
|
MOZ_ASSERT(aIndexValues.IsEmpty());
|
||||||
MOZ_ASSERT_IF(!aUpdateInfos.IsEmpty(), aUniqueIndexTable.Count());
|
MOZ_ASSERT_IF(!aUpdateInfos.IsEmpty(), aUniqueIndexTable.Count());
|
||||||
@ -18723,7 +18720,7 @@ DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement deleteStmt;
|
DatabaseConnection::CachedStatement deleteStmt;
|
||||||
AutoFallibleTArray<IndexDataValue, 32> indexValues;
|
AutoTArray<IndexDataValue, 32> indexValues;
|
||||||
|
|
||||||
DebugOnly<uint32_t> resultCountDEBUG = 0;
|
DebugOnly<uint32_t> resultCountDEBUG = 0;
|
||||||
|
|
||||||
@ -23410,7 +23407,7 @@ UpdateIndexDataValuesFunction::OnFunctionCall(mozIStorageValueArray* aValues,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoFallibleTArray<IndexDataValue, 32> indexValues;
|
AutoTArray<IndexDataValue, 32> indexValues;
|
||||||
rv = ReadCompressedIndexDataValues(aValues, 1, indexValues);
|
rv = ReadCompressedIndexDataValues(aValues, 1, indexValues);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -23509,10 +23506,9 @@ DeleteIndexOp::DeleteIndexOp(VersionChangeTransaction* aTransaction,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
DeleteIndexOp::RemoveReferencesToIndex(
|
DeleteIndexOp::RemoveReferencesToIndex(DatabaseConnection* aConnection,
|
||||||
DatabaseConnection* aConnection,
|
const Key& aObjectStoreKey,
|
||||||
const Key& aObjectStoreKey,
|
nsTArray<IndexDataValue>& aIndexValues)
|
||||||
FallibleTArray<IndexDataValue>& aIndexValues)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_ASSERT(!IsOnBackgroundThread());
|
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||||
@ -23767,7 +23763,7 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
DatabaseConnection::CachedStatement nullIndexDataValuesStmt;
|
DatabaseConnection::CachedStatement nullIndexDataValuesStmt;
|
||||||
|
|
||||||
Key lastObjectStoreKey;
|
Key lastObjectStoreKey;
|
||||||
AutoFallibleTArray<IndexDataValue, 32> lastIndexValues;
|
AutoTArray<IndexDataValue, 32> lastIndexValues;
|
||||||
|
|
||||||
bool hasResult;
|
bool hasResult;
|
||||||
while (NS_SUCCEEDED(rv = selectStmt->ExecuteStep(&hasResult)) && hasResult) {
|
while (NS_SUCCEEDED(rv = selectStmt->ExecuteStep(&hasResult)) && hasResult) {
|
||||||
@ -24111,7 +24107,7 @@ ObjectStoreAddOrPutRequestOp::RemoveOldIndexDataValues(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasResult) {
|
if (hasResult) {
|
||||||
AutoFallibleTArray<IndexDataValue, 32> existingIndexValues;
|
AutoTArray<IndexDataValue, 32> existingIndexValues;
|
||||||
rv = ReadCompressedIndexDataValues(indexValuesStmt,
|
rv = ReadCompressedIndexDataValues(indexValuesStmt,
|
||||||
0,
|
0,
|
||||||
existingIndexValues);
|
existingIndexValues);
|
||||||
@ -24639,7 +24635,7 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
MOZ_ASSERT(mUniqueIndexTable.isSome());
|
MOZ_ASSERT(mUniqueIndexTable.isSome());
|
||||||
|
|
||||||
// Write the index_data_values column.
|
// Write the index_data_values column.
|
||||||
AutoFallibleTArray<IndexDataValue, 32> indexValues;
|
AutoTArray<IndexDataValue, 32> indexValues;
|
||||||
rv = IndexDataValuesFromUpdateInfos(mParams.indexUpdateInfos(),
|
rv = IndexDataValuesFromUpdateInfos(mParams.indexUpdateInfos(),
|
||||||
mUniqueIndexTable.ref(),
|
mUniqueIndexTable.ref(),
|
||||||
indexValues);
|
indexValues);
|
||||||
|
@ -398,7 +398,7 @@ UsingArabicOrHebrewScriptSystemLocale()
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag,
|
gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t> &aBuffer)
|
nsTArray<uint8_t> &aBuffer)
|
||||||
{
|
{
|
||||||
gfxDWriteFontList *pFontList = gfxDWriteFontList::PlatformFontList();
|
gfxDWriteFontList *pFontList = gfxDWriteFontList::PlatformFontList();
|
||||||
|
|
||||||
@ -679,7 +679,7 @@ gfxDWriteFontEntry::IsCJKFont()
|
|||||||
mIsCJK = false;
|
mIsCJK = false;
|
||||||
|
|
||||||
const uint32_t kOS2Tag = TRUETYPE_TAG('O','S','/','2');
|
const uint32_t kOS2Tag = TRUETYPE_TAG('O','S','/','2');
|
||||||
AutoFallibleTArray<uint8_t,128> buffer;
|
AutoTArray<uint8_t, 128> buffer;
|
||||||
if (CopyFontTable(kOS2Tag, buffer) != NS_OK) {
|
if (CopyFontTable(kOS2Tag, buffer) != NS_OK) {
|
||||||
return mIsCJK;
|
return mIsCJK;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ protected:
|
|||||||
friend class gfxDWriteFontList;
|
friend class gfxDWriteFontList;
|
||||||
|
|
||||||
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer) override;
|
nsTArray<uint8_t>& aBuffer) override;
|
||||||
|
|
||||||
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle,
|
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle,
|
||||||
bool aNeedsBold);
|
bool aNeedsBold);
|
||||||
|
@ -457,7 +457,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
|||||||
|
|
||||||
RefPtr<gfxCharacterMap> charmap = new gfxCharacterMap();
|
RefPtr<gfxCharacterMap> charmap = new gfxCharacterMap();
|
||||||
|
|
||||||
AutoFallibleTArray<uint8_t,16384> buffer;
|
AutoTArray<uint8_t, 16384> buffer;
|
||||||
nsresult rv = CopyFontTable(TTAG_cmap, buffer);
|
nsresult rv = CopyFontTable(TTAG_cmap, buffer);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
@ -511,8 +511,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
FT2FontEntry::CopyFontTable(uint32_t aTableTag,
|
FT2FontEntry::CopyFontTable(uint32_t aTableTag, nsTArray<uint8_t>& aBuffer)
|
||||||
FallibleTArray<uint8_t>& aBuffer)
|
|
||||||
{
|
{
|
||||||
AutoFTFace face(this);
|
AutoFTFace face(this);
|
||||||
if (!face) {
|
if (!face) {
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
virtual hb_blob_t* GetFontTable(uint32_t aTableTag) override;
|
virtual hb_blob_t* GetFontTable(uint32_t aTableTag) override;
|
||||||
|
|
||||||
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer) override;
|
nsTArray<uint8_t>& aBuffer) override;
|
||||||
|
|
||||||
// Check for various kinds of brokenness, and set flags on the entry
|
// Check for various kinds of brokenness, and set flags on the entry
|
||||||
// accordingly so that we avoid using bad font tables
|
// accordingly so that we avoid using bad font tables
|
||||||
|
@ -744,7 +744,7 @@ gfxFontconfigFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
gfxFontconfigFontEntry::CopyFontTable(uint32_t aTableTag,
|
gfxFontconfigFontEntry::CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer)
|
nsTArray<uint8_t>& aBuffer)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!mIsDataUserFont,
|
NS_ASSERTION(!mIsDataUserFont,
|
||||||
"data fonts should be reading tables directly from memory");
|
"data fonts should be reading tables directly from memory");
|
||||||
|
@ -137,7 +137,7 @@ protected:
|
|||||||
// override to pull data from FTFace
|
// override to pull data from FTFace
|
||||||
virtual nsresult
|
virtual nsresult
|
||||||
CopyFontTable(uint32_t aTableTag,
|
CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer) override;
|
nsTArray<uint8_t>& aBuffer) override;
|
||||||
|
|
||||||
// if HB or GR faces are gone, close down the FT_Face
|
// if HB or GR faces are gone, close down the FT_Face
|
||||||
void MaybeReleaseFTFace();
|
void MaybeReleaseFTFace();
|
||||||
|
@ -523,12 +523,12 @@ gfxFontEntry::TryGetColorGlyphs()
|
|||||||
|
|
||||||
class gfxFontEntry::FontTableBlobData {
|
class gfxFontEntry::FontTableBlobData {
|
||||||
public:
|
public:
|
||||||
// Adopts the content of aBuffer.
|
explicit FontTableBlobData(nsTArray<uint8_t>&& aBuffer)
|
||||||
explicit FontTableBlobData(FallibleTArray<uint8_t>& aBuffer)
|
: mTableData(Move(aBuffer))
|
||||||
: mHashtable(nullptr), mHashKey(0)
|
, mHashtable(nullptr)
|
||||||
|
, mHashKey(0)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(FontTableBlobData);
|
MOZ_COUNT_CTOR(FontTableBlobData);
|
||||||
mTableData.SwapElements(aBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~FontTableBlobData() {
|
~FontTableBlobData() {
|
||||||
@ -570,8 +570,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The font table data block, owned (via adoption)
|
// The font table data block
|
||||||
FallibleTArray<uint8_t> mTableData;
|
nsTArray<uint8_t> mTableData;
|
||||||
|
|
||||||
// The blob destroy function needs to know the owning hashtable
|
// The blob destroy function needs to know the owning hashtable
|
||||||
// and the hashtable key, so that it can remove the entry.
|
// and the hashtable key, so that it can remove the entry.
|
||||||
@ -584,12 +584,12 @@ private:
|
|||||||
|
|
||||||
hb_blob_t *
|
hb_blob_t *
|
||||||
gfxFontEntry::FontTableHashEntry::
|
gfxFontEntry::FontTableHashEntry::
|
||||||
ShareTableAndGetBlob(FallibleTArray<uint8_t>& aTable,
|
ShareTableAndGetBlob(nsTArray<uint8_t>&& aTable,
|
||||||
nsTHashtable<FontTableHashEntry> *aHashtable)
|
nsTHashtable<FontTableHashEntry> *aHashtable)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
// adopts elements of aTable
|
// adopts elements of aTable
|
||||||
mSharedBlobData = new FontTableBlobData(aTable);
|
mSharedBlobData = new FontTableBlobData(Move(aTable));
|
||||||
mBlob = hb_blob_create(mSharedBlobData->GetTable(),
|
mBlob = hb_blob_create(mSharedBlobData->GetTable(),
|
||||||
mSharedBlobData->GetTableLength(),
|
mSharedBlobData->GetTableLength(),
|
||||||
HB_MEMORY_MODE_READONLY,
|
HB_MEMORY_MODE_READONLY,
|
||||||
@ -656,7 +656,7 @@ gfxFontEntry::GetExistingFontTable(uint32_t aTag, hb_blob_t **aBlob)
|
|||||||
|
|
||||||
hb_blob_t *
|
hb_blob_t *
|
||||||
gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
||||||
FallibleTArray<uint8_t>* aBuffer)
|
nsTArray<uint8_t>* aBuffer)
|
||||||
{
|
{
|
||||||
if (MOZ_UNLIKELY(!mFontTableCache)) {
|
if (MOZ_UNLIKELY(!mFontTableCache)) {
|
||||||
// we do this here rather than on fontEntry construction
|
// we do this here rather than on fontEntry construction
|
||||||
@ -675,7 +675,7 @@ gfxFontEntry::ShareFontTableAndGetBlob(uint32_t aTag,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry->ShareTableAndGetBlob(*aBuffer, mFontTableCache);
|
return entry->ShareTableAndGetBlob(Move(*aBuffer), mFontTableCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -725,7 +725,7 @@ gfxFontEntry::GetFontTable(uint32_t aTag)
|
|||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
FallibleTArray<uint8_t> buffer;
|
nsTArray<uint8_t> buffer;
|
||||||
bool haveTable = NS_SUCCEEDED(CopyFontTable(aTag, buffer));
|
bool haveTable = NS_SUCCEEDED(CopyFontTable(aTag, buffer));
|
||||||
|
|
||||||
return ShareFontTableAndGetBlob(aTag, haveTable ? &buffer : nullptr);
|
return ShareFontTableAndGetBlob(aTag, haveTable ? &buffer : nullptr);
|
||||||
|
@ -337,7 +337,7 @@ public:
|
|||||||
// Pass nullptr for aBuffer to indicate that the table is not present and
|
// Pass nullptr for aBuffer to indicate that the table is not present and
|
||||||
// nullptr will be returned. Also returns nullptr on OOM.
|
// nullptr will be returned. Also returns nullptr on OOM.
|
||||||
hb_blob_t *ShareFontTableAndGetBlob(uint32_t aTag,
|
hb_blob_t *ShareFontTableAndGetBlob(uint32_t aTag,
|
||||||
FallibleTArray<uint8_t>* aTable);
|
nsTArray<uint8_t>* aTable);
|
||||||
|
|
||||||
// Get the font's unitsPerEm from the 'head' table, in the case of an
|
// Get the font's unitsPerEm from the 'head' table, in the case of an
|
||||||
// sfnt resource. Will return kInvalidUPEM for non-sfnt fonts,
|
// sfnt resource. Will return kInvalidUPEM for non-sfnt fonts,
|
||||||
@ -469,7 +469,7 @@ protected:
|
|||||||
// Copy a font table into aBuffer.
|
// Copy a font table into aBuffer.
|
||||||
// The caller will be responsible for ownership of the data.
|
// The caller will be responsible for ownership of the data.
|
||||||
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer) {
|
nsTArray<uint8_t>& aBuffer) {
|
||||||
NS_NOTREACHED("forgot to override either GetFontTable or CopyFontTable?");
|
NS_NOTREACHED("forgot to override either GetFontTable or CopyFontTable?");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -605,7 +605,7 @@ private:
|
|||||||
// recorded in the hashtable entry so that others may use the same
|
// recorded in the hashtable entry so that others may use the same
|
||||||
// table.
|
// table.
|
||||||
hb_blob_t *
|
hb_blob_t *
|
||||||
ShareTableAndGetBlob(FallibleTArray<uint8_t>& aTable,
|
ShareTableAndGetBlob(nsTArray<uint8_t>&& aTable,
|
||||||
nsTHashtable<FontTableHashEntry> *aHashtable);
|
nsTHashtable<FontTableHashEntry> *aHashtable);
|
||||||
|
|
||||||
// Return a strong reference to the blob.
|
// Return a strong reference to the blob.
|
||||||
|
@ -216,7 +216,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual nsresult
|
virtual nsresult
|
||||||
CopyFontTable(uint32_t aTableTag, FallibleTArray<uint8_t>& aBuffer) override;
|
CopyFontTable(uint32_t aTableTag, nsTArray<uint8_t>& aBuffer) override;
|
||||||
|
|
||||||
void MaybeReleaseFTFace();
|
void MaybeReleaseFTFace();
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ private:
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
gfxSystemFcFontEntry::CopyFontTable(uint32_t aTableTag,
|
gfxSystemFcFontEntry::CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer)
|
nsTArray<uint8_t>& aBuffer)
|
||||||
{
|
{
|
||||||
if (!mFTFaceInitialized) {
|
if (!mFTFaceInitialized) {
|
||||||
mFTFaceInitialized = true;
|
mFTFaceInitialized = true;
|
||||||
|
@ -173,7 +173,7 @@ GDIFontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
|||||||
} else {
|
} else {
|
||||||
uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p');
|
uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p');
|
||||||
charmap = new gfxCharacterMap();
|
charmap = new gfxCharacterMap();
|
||||||
AutoFallibleTArray<uint8_t,16384> cmap;
|
AutoTArray<uint8_t, 16384> cmap;
|
||||||
rv = CopyFontTable(kCMAP, cmap);
|
rv = CopyFontTable(kCMAP, cmap);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
@ -234,8 +234,7 @@ GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, bool aNeedsBold
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
GDIFontEntry::CopyFontTable(uint32_t aTableTag,
|
GDIFontEntry::CopyFontTable(uint32_t aTableTag, nsTArray<uint8_t>& aBuffer)
|
||||||
FallibleTArray<uint8_t>& aBuffer)
|
|
||||||
{
|
{
|
||||||
if (!IsTrueType()) {
|
if (!IsTrueType()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -274,7 +274,7 @@ protected:
|
|||||||
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold);
|
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold);
|
||||||
|
|
||||||
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
virtual nsresult CopyFontTable(uint32_t aTableTag,
|
||||||
FallibleTArray<uint8_t>& aBuffer) override;
|
nsTArray<uint8_t>& aBuffer) override;
|
||||||
|
|
||||||
LOGFONTW mLogFont;
|
LOGFONTW mLogFont;
|
||||||
};
|
};
|
||||||
|
@ -43,8 +43,7 @@ nsHyphenator::IsValid()
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHyphenator::Hyphenate(const nsAString& aString,
|
nsHyphenator::Hyphenate(const nsAString& aString, nsTArray<bool>& aHyphens)
|
||||||
FallibleTArray<bool>& aHyphens)
|
|
||||||
{
|
{
|
||||||
if (!aHyphens.SetLength(aString.Length(), mozilla::fallible)) {
|
if (!aHyphens.SetLength(aString.Length(), mozilla::fallible)) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
|
|
||||||
nsresult Hyphenate(const nsAString& aText, FallibleTArray<bool>& aHyphens);
|
nsresult Hyphenate(const nsAString& aText, nsTArray<bool>& aHyphens);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~nsHyphenator();
|
~nsHyphenator();
|
||||||
|
@ -1472,7 +1472,7 @@ nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint)
|
|||||||
|
|
||||||
static bool
|
static bool
|
||||||
GetStrokeDashData(nsIFrame* aFrame,
|
GetStrokeDashData(nsIFrame* aFrame,
|
||||||
FallibleTArray<gfxFloat>& aDashes,
|
nsTArray<gfxFloat>& aDashes,
|
||||||
gfxFloat* aDashOffset,
|
gfxFloat* aDashOffset,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextContextPaint *aContextPaint)
|
||||||
{
|
{
|
||||||
@ -1576,7 +1576,7 @@ nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoFallibleTArray<gfxFloat, 10> dashes;
|
AutoTArray<gfxFloat, 10> dashes;
|
||||||
gfxFloat dashOffset;
|
gfxFloat dashOffset;
|
||||||
if (GetStrokeDashData(aFrame, dashes, &dashOffset, aContextPaint)) {
|
if (GetStrokeDashData(aFrame, dashes, &dashOffset, aContextPaint)) {
|
||||||
aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset);
|
aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset);
|
||||||
|
Loading…
Reference in New Issue
Block a user