| Index: third_party/WebKit/Source/wtf/text/StringStatics.cpp
|
| diff --git a/third_party/WebKit/Source/wtf/text/StringStatics.cpp b/third_party/WebKit/Source/wtf/text/StringStatics.cpp
|
| index 4d9899291721bfe4118f82ae0c4687de2ce76cee..3fbab70af3f9fd681bde7a8c13c22425e059d493 100644
|
| --- a/third_party/WebKit/Source/wtf/text/StringStatics.cpp
|
| +++ b/third_party/WebKit/Source/wtf/text/StringStatics.cpp
|
| @@ -33,69 +33,67 @@
|
|
|
| namespace WTF {
|
|
|
| -StringImpl* StringImpl::empty()
|
| -{
|
| - DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString));
|
| - WTF_ANNOTATE_BENIGN_RACE(&emptyString,
|
| - "Benign race on the reference counter of a static string created by StringImpl::empty");
|
| - return &emptyString;
|
| +StringImpl* StringImpl::empty() {
|
| + DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString));
|
| + WTF_ANNOTATE_BENIGN_RACE(&emptyString,
|
| + "Benign race on the reference counter of a static "
|
| + "string created by StringImpl::empty");
|
| + return &emptyString;
|
| }
|
|
|
| -StringImpl* StringImpl::empty16Bit()
|
| -{
|
| - DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString16Bit));
|
| - WTF_ANNOTATE_BENIGN_RACE(&emptyString,
|
| - "Benign race on the reference counter of a static string created by StringImpl::empty16Bit");
|
| - return &emptyString;
|
| +StringImpl* StringImpl::empty16Bit() {
|
| + DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString16Bit));
|
| + WTF_ANNOTATE_BENIGN_RACE(&emptyString,
|
| + "Benign race on the reference counter of a static "
|
| + "string created by StringImpl::empty16Bit");
|
| + return &emptyString;
|
| }
|
|
|
| -WTF_EXPORT DEFINE_GLOBAL(AtomicString, nullAtom)
|
| -WTF_EXPORT DEFINE_GLOBAL(AtomicString, emptyAtom)
|
| -WTF_EXPORT DEFINE_GLOBAL(AtomicString, starAtom)
|
| -WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlAtom)
|
| -WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlnsAtom)
|
| -WTF_EXPORT DEFINE_GLOBAL(AtomicString, xlinkAtom)
|
| +WTF_EXPORT DEFINE_GLOBAL(AtomicString, nullAtom) WTF_EXPORT
|
| + DEFINE_GLOBAL(AtomicString, emptyAtom) WTF_EXPORT
|
| + DEFINE_GLOBAL(AtomicString, starAtom) WTF_EXPORT
|
| + DEFINE_GLOBAL(AtomicString, xmlAtom) WTF_EXPORT
|
| + DEFINE_GLOBAL(AtomicString, xmlnsAtom) WTF_EXPORT
|
| + DEFINE_GLOBAL(AtomicString, xlinkAtom)
|
|
|
| -// This is not an AtomicString because it is unlikely to be used as an
|
| -// event/element/attribute name, so it shouldn't pollute the AtomicString hash
|
| -// table.
|
| -WTF_EXPORT DEFINE_GLOBAL(String, xmlnsWithColon)
|
| + // This is not an AtomicString because it is unlikely to be used as an
|
| + // event/element/attribute name, so it shouldn't pollute the AtomicString hash
|
| + // table.
|
| + WTF_EXPORT DEFINE_GLOBAL(String, xmlnsWithColon)
|
|
|
| -NEVER_INLINE unsigned StringImpl::hashSlowCase() const
|
| -{
|
| - if (is8Bit())
|
| - setHash(StringHasher::computeHashAndMaskTop8Bits(characters8(), m_length));
|
| - else
|
| - setHash(StringHasher::computeHashAndMaskTop8Bits(characters16(), m_length));
|
| - return existingHash();
|
| + NEVER_INLINE unsigned StringImpl::hashSlowCase() const {
|
| + if (is8Bit())
|
| + setHash(StringHasher::computeHashAndMaskTop8Bits(characters8(), m_length));
|
| + else
|
| + setHash(StringHasher::computeHashAndMaskTop8Bits(characters16(), m_length));
|
| + return existingHash();
|
| }
|
|
|
| -void AtomicString::init()
|
| -{
|
| - ASSERT(isMainThread());
|
| +void AtomicString::init() {
|
| + ASSERT(isMainThread());
|
|
|
| - new (NotNull, (void*)&nullAtom) AtomicString;
|
| - new (NotNull, (void*)&emptyAtom) AtomicString("");
|
| + new (NotNull, (void*)&nullAtom) AtomicString;
|
| + new (NotNull, (void*)&emptyAtom) AtomicString("");
|
| }
|
|
|
| -template<unsigned charactersCount>
|
| -PassRefPtr<StringImpl> addStaticASCIILiteral(const char (&characters)[charactersCount])
|
| -{
|
| - unsigned length = charactersCount - 1;
|
| - unsigned hash = StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(characters), length);
|
| - return adoptRef(StringImpl::createStatic(characters, length, hash));
|
| +template <unsigned charactersCount>
|
| +PassRefPtr<StringImpl> addStaticASCIILiteral(
|
| + const char (&characters)[charactersCount]) {
|
| + unsigned length = charactersCount - 1;
|
| + unsigned hash = StringHasher::computeHashAndMaskTop8Bits(
|
| + reinterpret_cast<const LChar*>(characters), length);
|
| + return adoptRef(StringImpl::createStatic(characters, length, hash));
|
| }
|
|
|
| -void StringStatics::init()
|
| -{
|
| - ASSERT(isMainThread());
|
| +void StringStatics::init() {
|
| + ASSERT(isMainThread());
|
|
|
| - // FIXME: These should be allocated at compile time.
|
| - new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFromLiteral);
|
| - new (NotNull, (void*)&xmlAtom) AtomicString(addStaticASCIILiteral("xml"));
|
| - new (NotNull, (void*)&xmlnsAtom) AtomicString(addStaticASCIILiteral("xmlns"));
|
| - new (NotNull, (void*)&xlinkAtom) AtomicString(addStaticASCIILiteral("xlink"));
|
| - new (NotNull, (void*)&xmlnsWithColon) String("xmlns:");
|
| + // FIXME: These should be allocated at compile time.
|
| + new (NotNull, (void*)&starAtom)
|
| + AtomicString("*", AtomicString::ConstructFromLiteral);
|
| + new (NotNull, (void*)&xmlAtom) AtomicString(addStaticASCIILiteral("xml"));
|
| + new (NotNull, (void*)&xmlnsAtom) AtomicString(addStaticASCIILiteral("xmlns"));
|
| + new (NotNull, (void*)&xlinkAtom) AtomicString(addStaticASCIILiteral("xlink"));
|
| + new (NotNull, (void*)&xmlnsWithColon) String("xmlns:");
|
| }
|
| -
|
| }
|
|
|