landing attempt #2 for 195262 - support for static atoms, and converting atoms over to UTF8 to reduce bloat - now without performance regressions!

sr=darin, r=dbaron


git-svn-id: svn://10.0.0.236/trunk@140260 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com
2003-03-25 18:55:59 +00:00
parent 71d3e6e03f
commit f24ccb3da0
60 changed files with 766 additions and 501 deletions

View File

@@ -49,11 +49,11 @@ static void Assert(PRBool aCondition, const char* aStatement)
printf("%s: %s\n", aCondition?"PASS":"FAIL", aStatement);
}
static void AssertString(nsIAtom *aAtom, const nsAString& aString)
static void AssertString(nsIAtom *aAtom, const nsACString& aString)
{
const PRUnichar *str;
NS_STATIC_CAST(AtomImpl*,aAtom)->GetUnicode(&str);
Assert(nsDependentString(str) == aString, "string is correct");
const char *str;
NS_STATIC_CAST(AtomImpl*,aAtom)->GetUTF8String(&str);
Assert(nsDependentCString(str) == aString, "string is correct");
}
static void AssertPermanence(nsIAtom *aAtom, PRBool aPermanence)
@@ -65,21 +65,21 @@ static void AssertPermanence(nsIAtom *aAtom, PRBool aPermanence)
int main()
{
nsCOMPtr<nsIAtom> foo = do_GetAtom("foo");
AssertString(foo, NS_LITERAL_STRING("foo"));
AssertString(foo, NS_LITERAL_CSTRING("foo"));
AssertPermanence(foo, PR_FALSE);
nsCOMPtr<nsIAtom> foop = do_GetPermanentAtom("foo");
AssertString(foop, NS_LITERAL_STRING("foo"));
AssertString(foop, NS_LITERAL_CSTRING("foo"));
AssertPermanence(foop, PR_TRUE);
Assert(foo == foop, "atoms are equal");
nsCOMPtr<nsIAtom> barp = do_GetPermanentAtom("bar");
AssertString(barp, NS_LITERAL_STRING("bar"));
AssertString(barp, NS_LITERAL_CSTRING("bar"));
AssertPermanence(barp, PR_TRUE);
nsCOMPtr<nsIAtom> bar = do_GetAtom("bar");
AssertString(bar, NS_LITERAL_STRING("bar"));
AssertString(bar, NS_LITERAL_CSTRING("bar"));
AssertPermanence(bar, PR_TRUE);
Assert(bar == barp, "atoms are equal");