Backed out 2 changesets (bug 1386103) for Android x86 build bustage

Backed out changeset eec506d87d03 (bug 1386103)
Backed out changeset 3f9ec011c9bd (bug 1386103)

MozReview-Commit-ID: 8ak71R7vUOC
This commit is contained in:
Phil Ringnalda 2017-08-08 22:08:54 -07:00
parent 7512aa2dea
commit 858a553b02
15 changed files with 64 additions and 54 deletions

View File

@ -19,10 +19,12 @@
//// NullPrincipalURI
NullPrincipalURI::NullPrincipalURI()
: mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
{
}
NullPrincipalURI::NullPrincipalURI(const NullPrincipalURI& aOther)
: mPath(mPathBytes, ArrayLength(mPathBytes), ArrayLength(mPathBytes) - 1)
{
mPath.Assign(aOther.mPath);
}
@ -38,9 +40,9 @@ NullPrincipalURI::Init()
nsresult rv = uuidgen->GenerateUUIDInPlace(&id);
NS_ENSURE_SUCCESS(rv, rv);
mPath.SetLength(NSID_LENGTH - 1); // -1 because NSID_LENGTH counts the '\0'
id.ToProvidedString(
*reinterpret_cast<char(*)[NSID_LENGTH]>(mPath.BeginWriting()));
MOZ_ASSERT(mPathBytes == mPath.BeginWriting());
id.ToProvidedString(mPathBytes);
MOZ_ASSERT(mPath.Length() == NSID_LENGTH - 1);
MOZ_ASSERT(strlen(mPath.get()) == NSID_LENGTH - 1);

View File

@ -52,7 +52,8 @@ private:
nsresult Init();
nsAutoCStringN<NSID_LENGTH> mPath;
char mPathBytes[NSID_LENGTH];
nsFixedCString mPath;
};
#endif // __NullPrincipalURI_h__

View File

@ -37,7 +37,7 @@ namespace dom {
namespace indexedDB {
class MOZ_STACK_CLASS LoggingIdString final
: public nsAutoCStringN<NSID_LENGTH>
: public nsAutoCString
{
public:
LoggingIdString()
@ -61,10 +61,9 @@ public:
LoggingIdString(const nsID& aID)
{
static_assert(NSID_LENGTH > 1, "NSID_LENGTH is set incorrectly!");
static_assert(NSID_LENGTH <= kStorageSize,
"nsID string won't fit in our storage!");
// Capacity() excludes the null terminator; NSID_LENGTH includes it.
MOZ_ASSERT(Capacity() + 1 == NSID_LENGTH);
static_assert(NSID_LENGTH <= kDefaultStorageSize,
"nID string won't fit in our storage!");
MOZ_ASSERT(Capacity() > NSID_LENGTH);
if (IndexedDatabaseManager::GetLoggingMode() !=
IndexedDatabaseManager::Logging_Disabled) {

View File

@ -1978,9 +1978,12 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
extraArgs.push_back(idStr);
extraArgs.push_back(IsForBrowser() ? "-isForBrowser" : "-notForBrowser");
nsAutoCStringN<1024> boolPrefs;
nsAutoCStringN<1024> intPrefs;
nsAutoCStringN<1024> stringPrefs;
char boolBuf[1024];
char intBuf[1024];
char strBuf[1024];
nsFixedCString boolPrefs(boolBuf, 1024, 0);
nsFixedCString intPrefs(intBuf, 1024, 0);
nsFixedCString stringPrefs(strBuf, 1024, 0);
size_t prefsLen;
ContentPrefs::GetContentPrefs(&prefsLen);

View File

@ -600,7 +600,8 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
// given node.
// SynchronizeUsingTemplate contains code used to update textnodes,
// so make sure to modify both when changing this
nsAutoString attrValue;
char16_t attrbuf[128];
nsFixedString attrValue(attrbuf, ArrayLength(attrbuf), 0);
tmplKid->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
if (!attrValue.IsEmpty()) {
nsAutoString value;
@ -736,7 +737,11 @@ nsXULContentBuilder::CopyAttributesToElement(nsIContent* aTemplateNode,
// XXXndeakin ignore namespaces until bug 321182 is fixed
if (attribName != nsGkAtoms::id && attribName != nsGkAtoms::uri) {
nsAutoString attribValue;
// Create a buffer here, because there's a chance that an
// attribute in the template is going to be an RDF URI, which is
// usually longish.
char16_t attrbuf[128];
nsFixedString attribValue(attrbuf, ArrayLength(attrbuf), 0);
aTemplateNode->GetAttr(attribNameSpaceID, attribName, attribValue);
if (!attribValue.IsEmpty()) {
nsAutoString value;
@ -873,7 +878,8 @@ nsXULContentBuilder::SynchronizeUsingTemplate(nsIContent* aTemplateNode,
// This code is similar to that in BuildContentFromTemplate
if (tmplKid->NodeInfo()->Equals(nsGkAtoms::textnode,
kNameSpaceID_XUL)) {
nsAutoString attrValue;
char16_t attrbuf[128];
nsFixedString attrValue(attrbuf, ArrayLength(attrbuf), 0);
tmplKid->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
if (!attrValue.IsEmpty()) {
nsAutoString value;

View File

@ -255,7 +255,8 @@ nsXULContentUtils::GetResource(int32_t aNameSpaceID, const nsAString& aAttribute
nsresult rv;
nsAutoStringN<256> uri;
char16_t buf[256];
nsFixedString uri(buf, ArrayLength(buf), 0);
if (aNameSpaceID != kNameSpaceID_Unknown && aNameSpaceID != kNameSpaceID_None) {
rv = nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, uri);
// XXX ignore failure; treat as "no namespace"

View File

@ -687,7 +687,8 @@ RDFContainerImpl::GetNextValue(nsIRDFResource** aResult)
}
static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;
nsAutoCStringN<sizeof(kRDFNameSpaceURI) + 16> nextValStr;
char buf[sizeof(kRDFNameSpaceURI) + 16];
nsFixedCString nextValStr(buf, sizeof(buf), 0);
nextValStr = kRDFNameSpaceURI;
nextValStr.Append('_');
nextValStr.AppendInt(nextVal, 10);

View File

@ -20,6 +20,7 @@
namespace mozilla { namespace pkix { class DERArray; } }
class nsAutoString;
class nsINSSComponent;
class nsIASN1Sequence;

View File

@ -165,8 +165,8 @@ levenshteinDistance(const nsAString &aStringS,
// we be able to see the current row and the previous one.
// Allocate memory for two rows.
AutoTArray<int, nsAutoString::kStorageSize> row1;
AutoTArray<int, nsAutoString::kStorageSize> row2;
AutoTArray<int, nsAutoString::kDefaultStorageSize> row1;
AutoTArray<int, nsAutoString::kDefaultStorageSize> row2;
// Declare the raw pointers that will actually be used to access the memory.
int *prevRow = row1.AppendElements(sLen + 1);

View File

@ -20,18 +20,23 @@
*
* See also nsCString::AppendPrintf().
*/
class nsPrintfCString : public nsAutoCStringN<16>
class nsPrintfCString : public nsFixedCString
{
typedef nsCString string_type;
public:
explicit nsPrintfCString(const char_type* aFormat, ...) MOZ_FORMAT_PRINTF(2, 3)
: nsFixedCString(mLocalBuffer, kLocalBufferSize, 0)
{
va_list ap;
va_start(ap, aFormat);
AppendPrintf(aFormat, ap);
va_end(ap);
}
private:
static const uint32_t kLocalBufferSize = 16;
char_type mLocalBuffer[kLocalBufferSize];
};
#endif // !defined(nsPrintfCString_h___)

View File

@ -24,14 +24,11 @@ class nsCStringRepr;
} // namespace detail
} // namespace mozilla
static const size_t AutoStringDefaultStorageSize = 64;
// Double-byte (char16_t) string types.
class nsAString;
class nsSubstringTuple;
class nsString;
template<size_t N> class nsAutoStringN;
using nsAutoString = nsAutoStringN<AutoStringDefaultStorageSize>;
class nsAutoString;
class nsDependentString;
class nsDependentSubstring;
class nsPromiseFlatString;
@ -43,8 +40,7 @@ class nsXPIDLString;
class nsACString;
class nsCSubstringTuple;
class nsCString;
template<size_t N> class nsAutoCStringN;
using nsAutoCString = nsAutoCStringN<AutoStringDefaultStorageSize>;
class nsAutoCString;
class nsDependentCString;
class nsDependentCSubstring;
class nsPromiseFlatCString;

View File

@ -551,15 +551,14 @@ protected:
* it contains is significantly smaller or any larger than 64 characters.
*
* NAMES:
* nsAutoStringN / nsAutoString for wide characters
* nsAutoCStringN / nsAutoCString for narrow characters
* nsAutoString for wide characters
* nsAutoCString for narrow characters
*/
template<size_t N>
class MOZ_NON_MEMMOVABLE nsTAutoStringN_CharT : public nsTFixedString_CharT
class MOZ_NON_MEMMOVABLE nsTAutoString_CharT : public nsTFixedString_CharT
{
public:
typedef nsTAutoStringN_CharT<N> self_type;
typedef nsTAutoString_CharT self_type;
public:
@ -567,49 +566,48 @@ public:
* constructors
*/
nsTAutoStringN_CharT()
: fixed_string_type(mStorage, N, 0)
nsTAutoString_CharT()
: fixed_string_type(mStorage, kDefaultStorageSize, 0)
{
}
explicit
nsTAutoStringN_CharT(char_type aChar)
: fixed_string_type(mStorage, N, 0)
nsTAutoString_CharT(char_type aChar)
: fixed_string_type(mStorage, kDefaultStorageSize, 0)
{
Assign(aChar);
}
explicit
nsTAutoStringN_CharT(const char_type* aData,
size_type aLength = size_type(-1))
: fixed_string_type(mStorage, N, 0)
nsTAutoString_CharT(const char_type* aData, size_type aLength = size_type(-1))
: fixed_string_type(mStorage, kDefaultStorageSize, 0)
{
Assign(aData, aLength);
}
#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
explicit
nsTAutoStringN_CharT(char16ptr_t aData, size_type aLength = size_type(-1))
: nsTAutoStringN_CharT(static_cast<const char16_t*>(aData), aLength)
nsTAutoString_CharT(char16ptr_t aData, size_type aLength = size_type(-1))
: nsTAutoString_CharT(static_cast<const char16_t*>(aData), aLength)
{
}
#endif
nsTAutoStringN_CharT(const self_type& aStr)
: fixed_string_type(mStorage, N, 0)
nsTAutoString_CharT(const self_type& aStr)
: fixed_string_type(mStorage, kDefaultStorageSize, 0)
{
Assign(aStr);
}
explicit
nsTAutoStringN_CharT(const substring_type& aStr)
: fixed_string_type(mStorage, N, 0)
nsTAutoString_CharT(const substring_type& aStr)
: fixed_string_type(mStorage, kDefaultStorageSize, 0)
{
Assign(aStr);
}
MOZ_IMPLICIT nsTAutoStringN_CharT(const substring_tuple_type& aTuple)
: fixed_string_type(mStorage, N, 0)
MOZ_IMPLICIT nsTAutoString_CharT(const substring_tuple_type& aTuple)
: fixed_string_type(mStorage, kDefaultStorageSize, 0)
{
Assign(aTuple);
}
@ -648,16 +646,16 @@ public:
return *this;
}
static const size_t kStorageSize = N;
enum
{
kDefaultStorageSize = 64
};
private:
char_type mStorage[N];
char_type mStorage[kDefaultStorageSize];
};
// We define this typedef instead of providing a default value for N so that so
// there is a default typename that doesn't require angle brackets.
using nsTAutoString_CharT = nsTAutoStringN_CharT<AutoStringDefaultStorageSize>;
//
// nsAutoString stores pointers into itself which are invalidated when an

View File

@ -11,7 +11,6 @@
#define nsTString_CharT nsCString
#define nsTStringRepr_CharT nsCStringRepr
#define nsTFixedString_CharT nsFixedCString
#define nsTAutoStringN_CharT nsAutoCStringN
#define nsTAutoString_CharT nsAutoCString
#define nsTSubstring_CharT nsACString
#define PrintfAppend_CharT PrintfAppend_nsACString

View File

@ -11,7 +11,6 @@
#define nsTString_CharT nsString
#define nsTStringRepr_CharT nsStringRepr
#define nsTFixedString_CharT nsFixedString
#define nsTAutoStringN_CharT nsAutoStringN
#define nsTAutoString_CharT nsAutoString
#define nsTSubstring_CharT nsAString
#define PrintfAppend_CharT PrintfAppend_nsAString

View File

@ -12,7 +12,6 @@
#undef nsTString_CharT
#undef nsTStringRepr_CharT
#undef nsTFixedString_CharT
#undef nsTAutoStringN_CharT
#undef nsTAutoString_CharT
#undef nsTSubstring_CharT
#undef PrintfAppend_CharT