I recently landed the patches in bug 534136. This introduced a few changes:
1. Atoms now hold UTF16 strings, rather than UTF8 strings. All the same
APIs still work, such as do_GetAtom(myCString) and
atom->EqualsUTF8(myCString), however it is generally more performant to
use UTF16 strings when dealing with atoms.
2. If you need to use the string value of an atom there are now nicer
ways to do so:
nsAtomString(myAtom)
nsDependentAtomString(myAtom)
nsAtomCString(myAtom)
The first two produce nsAStrings, the last one produce an nsACString. So
for example the following old code:
nsAutoString tmp;
myAtom->ToString(tmp);
rv = MySetNameFunction(tmp);
can now be replace with
rv = MySetNameFunction(nsDependentAtomString(myAtom));
Neither nsAtomString nor nsDependentAtomString does any string copying.
However nsAtomString does do an addref/release of the nsStringBuffer and
so is slightly more expensive. However since the resulting string owns
the string buffer, that means that the buffer can be further shared if
the callee (MySetNameFunction above) is able to do so.
nsAtomCString obviously has to do some copying while converting UTF16->UTF8.
These new string types are declared and implemented in nsIAtom.idl
http://mxr.mozilla.org/mozilla-central/source/xpcom/ds/nsIAtom.idl
Please use these new types in new code you are writing. It makes the
code much more readable and if we need to do future API changes it
should make those simpler.
3. Many of the functions on nsIAtom are now inlined. Things like
ToString and Equals are done with no virtual function overhead. They can
still be used from script though (see the idl file for how this is done).
4. You must not attempt to *implement* nsIAtom from script. In reality
this has never worked given that there was no way to get the correct
pointer identity while doing so. However things are even worse now in
that it will result in crashes if you attempt to do so. We'll eventually
add support to XPIDL to make it possible to declare an interface as "not
script implementable" which will make XPConnect throw if you attempt to
implement nsIAtom. This is tracked in bug 543613.
/ Jonas